Deutsch English Français Italiano |
<va6m82$bg45$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: "B. Pym" <Nobody447095@here-nor-there.org> Newsgroups: comp.lang.lisp Subject: Re: MAP (and variants) vs LOOP - Popular opinion observation? Date: Thu, 22 Aug 2024 06:35:48 -0000 (UTC) Organization: A noiseless patient Spider Lines: 27 Message-ID: <va6m82$bg45$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Injection-Date: Thu, 22 Aug 2024 08:35:49 +0200 (CEST) Injection-Info: dont-email.me; posting-host="64bd121bd2d63ac018524a5d24d8277c"; logging-data="376965"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18XA9QqQ5WYh7WyOPcj7Jdd" User-Agent: XanaNews/1.18.1.6 Cancel-Lock: sha1:C8968q4LydjBn4XU2+1ctbKBJBs= 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)) newLISP (let (result) (dolist (x '(2 9 22 25 42 49 58)) (println (format "%d - %d" $idx x)) (when (odd? x) (push (sqrt x) result -1))) result) 0 - 2 1 - 9 2 - 22 3 - 25 4 - 42 5 - 49 6 - 58 (3 5 7)