2009-06-28

list processing in lisp

On Jun 28, 6:26 am, Marc Tfardy wrote:
> Hi!
>
> I looking for a ELISP function that do the job like Partition in
> Mathematica. The simplest case:
>
> (partition '(a b c d e f) 2)
>
> should return:
> ((a b) (c d) (e f))
>
> Is there something ready out from the box?
>
> In more sophisticated cases one can define overlap with offset and much
> more interesting things - look at:http://documents.wolfram.com/mathematica/functions/Partition

there's no such function. You have to write it yourself.

my experiences with lisps from Mathematica is that, most basic list processing functions in Mathematica does not exist in lisp, and in general, there's no coherent libraries to use either. Everyone just write it from scratch. (it's not easy to write them either, due to the cons business)

things like Partition, Flatten, Part, Level, etc gets asked every maybe 3 months for example in comp.lang.lisp over the past decade, and the answers are always wild.

might be of interest:

• Xah Lee's Computing Experience Bio
http://xahlee.org/PageTwo_dir/Personal_dir/xah_comp_exp.html

• Fundamental Problems of Lisp
http://xahlee.org/UnixResource_dir/writ/lisp_problems.html

the first one is some of my experience from Mathematica to lisp. The second one is about the cons business, and the shock that lisp doesn't do list procesing well.

Xah
∑ http://xahlee.org/

No comments:

Post a Comment