Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

You prefer the company of the opposite sex, but are well liked by your own.


comp / comp.lang.lisp / Re: MAP (and variants) vs LOOP - Popular opinion observation?

SubjectAuthor
o Re: MAP (and variants) vs LOOP - Popular opinion observation?B. Pym

1
Subject: Re: MAP (and variants) vs LOOP - Popular opinion observation?
From: B. Pym
Newsgroups: comp.lang.lisp
Organization: A noiseless patient Spider
Date: Thu, 22 Aug 2024 06:35 UTC
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Nobody447095@here-nor-there.org (B. Pym)
Newsgroups: comp.lang.lisp
Subject: Re: MAP (and variants) vs LOOP - Popular opinion observation?
Date: Thu, 22 Aug 2024 06:35:48 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 27
Message-ID: <va6m82$bg45$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Injection-Date: Thu, 22 Aug 2024 08:35:49 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="64bd121bd2d63ac018524a5d24d8277c";
logging-data="376965"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18XA9QqQ5WYh7WyOPcj7Jdd"
User-Agent: XanaNews/1.18.1.6
Cancel-Lock: sha1:C8968q4LydjBn4XU2+1ctbKBJBs=
View all headers

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)

1

rocksolid light 0.9.8
clearnet tor