Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Loop macro

6 views
Skip to first unread message

Robert L.

unread,
Dec 9, 2017, 3:18:45 PM12/9/17
to
Chris Riesbeck wrote:

> LOOP ... COLLECT vs. MAPCAR -- LAMBDA is a tie for me,
> but if you want to collect only certain values, then
>
> (loop for x in l
> when <test x>
> collect x)
>
> is hands-down clearer than
>
> (mapcan #'(lambda (x)
> (when <test x> (list x)))
> l)
>
> while
>
> (remove-if-not #'(lambda (x) <test x>) l)
>
> is OK but that double-negative leaves me cold.


(filter even? (range 22))
===>
(0 2 4 6 8 10 12 14 16 18 20)


--
Jews totally run Hollywood.... But I don't care if Americans think we're
running the news media, Hollywood, Wall Street, or the government. I just care
that we get to keep running them. --- Joel Stein
http://archive.org/details/nolies
0 new messages