map instead of loop

Liste des GroupesRevenir à cl lisp 
Sujet : map instead of loop
De : Nobody447095 (at) *nospam* here-nor-there.org (B. Pym)
Groupes : comp.lang.lisp comp.lang.scheme
Date : 03. Jul 2025, 23:28:57
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <1047078$d91n$1@dont-email.me>
User-Agent : XanaNews/1.18.1.6
Pascal Costanza wrote:

Besides trying to figure out what's more idiomatic, it is also
(more?) important to note that one of the two expressions traverse
the list once while the other traverses it twice. Traversing a
list more often than necessary leads to less efficient code, which
may or may not matter.
 
Apart from that, I tend to prefer LOOP:
 
(loop for i in list
       collect (foo (bar i)))

Gauche Scheme (using function composition)

(map (.$ foo bar) List)

Date Sujet#  Auteur
3 Jul23:28 o map instead of loop1B. Pym

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal