Sujet : Re: the "loop" macro
De : Nobody447095 (at) *nospam* here-nor-there.org (B. Pym)
Groupes : comp.lang.lispDate : 18. Jun 2025, 14:55:08
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <102ugfo$35ji4$1@dont-email.me>
References : 1
User-Agent : XanaNews/1.18.1.6
B. Pym wrote:
(loop for item in list
maximize (f item))
It's shorter in Gauche Scheme.
(use srfi-42) ;; max-ec
(max-ec (: x '(-8 2 0)) (abs x))
===>
8
(loop for x in '(1 2 3 4 5 6 7)
when (evenp x)
collect x into evens
else
collect x into odds
finally
(return (values evens odds)))
=> (2 4 6), (1 3 5 7)
It's shorter in Gauche Scheme.
(partition even? '(2 3 4 5 6 7))
===>
(2 4 6)
(3 5 7)