Grupy dyskusyjne Google nie obsługują już nowych postów ani subskrypcji z Usenetu. Treści historyczne nadal będą dostępne.

Loop macro

6 wyświetleń
Przejdź do pierwszej nieodczytanej wiadomości

Robert L.

nieprzeczytany,
9 gru 2017, 15:18:459.12.2017
do
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
Nowe wiadomości: 0