Subject: Re: newby Q: iterating over /longest/ of multiple lists
From: rpw3@rpw3.org (Rob Warnock)
Date: Thu, 08 Apr 2004 06:29:46 -0500
Newsgroups: comp.lang.lisp
Message-ID: <UfKdnc2coY83qujd4p2dnA@speakeasy.net>
Kenny Tilton  <ktilton@nyc.rr.com> wrote:
+---------------
| I see the MAP family always stops at the shortest of multiple lists being
| iterated over, and my naive attempts at persuading LOOP to soldier on...
...
| Am I missing a trick on LOOP, or is a job only DO can do? If it helps, 
| in my particular case I have only two possibilities: (a) two lists of 
| equal length, or (b) one list of plusp length, one nil.
+---------------

Others have given you good options, but I simply couldn't let
this go by without sharing one of my favorite abuses of LOOP:  ;-}

    > (loop for i in '(0 1 2 3 4 5 6 7 8 9)
	    and j in '#1=(a b c . #1#)
	collect (list i j))

    ((0 A) (1 B) (2 C) (3 A) (4 B) (5 C) (6 A) (7 B) (8 C) (9 A))
    > 


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607