Sujet : map instead of loop
De : Nobody447095 (at) *nospam* here-nor-there.org (B. Pym)
Groupes : comp.lang.lisp comp.lang.schemeDate : 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)