Re: MAP (and variants) vs LOOP - Popular opinion observation?

Liste des GroupesRevenir à cl lisp 
Sujet : Re: MAP (and variants) vs LOOP - Popular opinion observation?
De : Nobody447095 (at) *nospam* here-nor-there.org (B. Pym)
Groupes : comp.lang.lisp
Date : 18. Jun 2025, 21:50:07
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <102v8pu$3c4n2$1@dont-email.me>
User-Agent : XanaNews/1.18.1.6
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)

Date Sujet#  Auteur
18 Jun 25 o Re: MAP (and variants) vs LOOP - Popular opinion observation?1B. Pym

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal