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 : 22. Aug 2024, 07:35:48
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <va6m82$bg45$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))

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)

Date Sujet#  Auteur
22 Aug 24 o Re: MAP (and variants) vs LOOP - Popular opinion observation?1B. Pym

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal