Subject: Re: macro code review!!
From: rpw3@rpw3.org (Rob Warnock)
Date: Wed, 14 Dec 2005 07:08:47 -0600
Newsgroups: comp.lang.lisp
Message-ID: <CdadnSPME9LChD3enZ2dnUVZ_sednZ2d@speakeasy.net>
Surendra Singhi  <efuzzyone@netscape.net> wrote:
+---------------
| Pascal Costanza <pc@p-cos.net> writes:
...
| >           collect menu-name into menu-names
| >           collect menu into menu-list
| >           collect `(,menu (make-menu-with-items
...
| Thanks, I didn't knew it was possible to use multiple collects.
+---------------

Not only that, but they can be conditional, and you can
even collect the same thing more than once if you need to.
For example:

    > (loop for i in (iota 30)
	if (oddp i)
	  collect i into odds
	else			; cheaper than "when (evenp i)"
	  collect i into evens
	when (zerop (mod i 3))
	  collect i into triples
	when (zerop (mod i 5))
	  collect i into fivers
	finally (return (values odds evens triples fivers)))

    (1 3 5 7 9 11 13 15 17 19 21 23 25 27 29)
    (0 2 4 6 8 10 12 14 16 18 20 22 24 26 28)
    (0 3 6 9 12 15 18 21 24 27)
    (0 5 10 15 20 25)
    > 


-Rob

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