Deutsch English Français Italiano |
<vbk3vn$1tpt1$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!news.nobody.at!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: "B. Pym" <Nobody447095@here-nor-there.org> Newsgroups: comp.lang.lisp,comp.lang.scheme Subject: Re: MAP (and variants) vs LOOP - Popular opinion observation? Date: Sun, 8 Sep 2024 12:06:16 -0000 (UTC) Organization: A noiseless patient Spider Lines: 24 Message-ID: <vbk3vn$1tpt1$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Injection-Date: Sun, 08 Sep 2024 14:06:17 +0200 (CEST) Injection-Info: dont-email.me; posting-host="ca987dadbaef2aac0a61f448ffc30def"; logging-data="2025377"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19BTXOTTfZGc9m4gjp1nRdS" User-Agent: XanaNews/1.18.1.6 Cancel-Lock: sha1:L6F2otge8oyfxW9n5YkaJFZTWCU= Bytes: 1393 > 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 (use srfi-13) ;; string-upcase (filter-map (lambda (x i) (print i " - " x) (and (string? x) (string-upcase x))) '(foo "an" 8 "why") (lrange 0)) 0 - foo 1 - an 2 - 8 3 - why ("AN" "WHY")