Path: news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: "B. Pym" Newsgroups: comp.lang.lisp Subject: Re: MAP (and variants) vs LOOP - Popular opinion observation? Date: Wed, 18 Jun 2025 20:50:07 -0000 (UTC) Organization: A noiseless patient Spider Lines: 28 Message-ID: <102v8pu$3c4n2$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Injection-Date: Wed, 18 Jun 2025 22:50:07 +0200 (CEST) Injection-Info: dont-email.me; posting-host="1d8279f8f1ebce16497eecb88ef68b8e"; logging-data="3543778"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+ux6yfFNIo56TvM/sIc3D6" User-Agent: XanaNews/1.18.1.6 Cancel-Lock: sha1:49dhK2hVmwV9F4T/OGYdexTl8gQ= Nathan Baum wrote: > Then suppose you later need the loop/map to collect some of the values > under certain conditions. You might have > > (loop for x in (get-list) > for i from 0 > do (format t "~A - ~A~%" i x) > if (test x) > collect (foo x)) Gauche Scheme (filter-map (lambda (x i) (print i " - " x) (and (odd? x) (square x))) '(0 2 3 5 6 9) (liota)) ===> 0 - 0 1 - 2 2 - 3 3 - 5 4 - 6 5 - 9 (9 25 81)