Sujet : Collect when
De : Nobody447095 (at) *nospam* here-nor-there.org (B. Pym)
Groupes : comp.lang.lispDate : 20. Jun 2025, 22:58:52
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <1034lir$96pn$1@dont-email.me>
User-Agent : XanaNews/1.18.1.6
(loop for x in y
when (f x)
collect (g x))
Gauche Scheme:
(define f positive?)
(define (g x) (and (odd? x) (* x x)))
(define y (iota 22 -8))
(append-map
(lambda(x) (if (f x) (list (g x)) '()))
y)
===>
(1 #f 9 #f 25 #f 49 #f 81 #f 121 #f 169)