Mark Cox <markcox80@gmail.com> wrote:
+---------------
| I wish I had the neurons and synapses that allowed me
| to navigate my data structures using CADAAR and CADADR!
+---------------
The one place I find myself frequently using CDD*R
is in destructuring lists by "gulps" in LOOP, e.g.:
> (defun group-by-triples (list)
(loop for (a b c) on list by #'cdddr
collect (list a b c)))
GROUP-BY-TRIPLES
> (group-by-triples '(0 1 2 3 4 5 6 7 8 9 10 11 12))
((0 1 2) (3 4 5) (6 7 8) (9 10 11) (12 NIL NIL))
>
Note: Whether sublist (12 NIL NIL) is the "correct" result or a "bug"
depends upon your application. Adjusting the function so that the last
sublist is (12) is left as an exercise for the reader. ;-} ;-}
-Rob
-----
Rob Warnock <rpw3@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607