Deutsch   English   Français   Italiano  
<1047078$d91n$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: nntp.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: "B. Pym" <Nobody447095@here-nor-there.org>
Newsgroups: comp.lang.lisp,comp.lang.scheme
Subject: map instead of loop
Date: Thu, 3 Jul 2025 22:28:57 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 16
Message-ID: <1047078$d91n$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Injection-Date: Fri, 04 Jul 2025 00:28:57 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="587fd4467aed8792e547a0192a11f90c";
	logging-data="435255"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/F5l3Na2mLWEs+g7kE839m"
User-Agent: XanaNews/1.18.1.6
Cancel-Lock: sha1:zgfoel13KQC+CziEDh3dKlGSybQ=

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)