Re: newbie question



"dvlfrnd" <iresjen@xxxxxxxxx> writes:

> say there's a list of even length
> (a b c d e f ......)
>
> how do i turn this into
> ((a b) (c d) (e f)....)

The mapping idiom doesn't work so well here, since that's all about
transforming each element individually, whereas here you process
elements two by two (or the list as such in steps of two).

I think this is the most natural solution in Common Lisp:

(loop for (x y) on list by #'cddr collect (list x y))

--
Frode Vatvedt Fjeld
.