Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

The ripest fruit falls first. -- William Shakespeare, "Richard II"


comp / comp.lang.lisp / Re: Question about loop

SubjectAuthor
o Re: Question about loopB. Pym

1
Subject: Re: Question about loop
From: B. Pym
Newsgroups: comp.lang.lisp
Organization: A noiseless patient Spider
Date: Mon, 26 Aug 2024 08:14 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: Question about loop
Date: Mon, 26 Aug 2024 08:14:45 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 23
Message-ID: <vahdhi$2cmjb$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Injection-Date: Mon, 26 Aug 2024 10:14:46 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="c62e5a4788eb434261aeb34e5a871e27";
logging-data="2513515"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Mdw7jLE/dCCFcXf7XSiX/"
User-Agent: XanaNews/1.18.1.6
Cancel-Lock: sha1:WmDprWxEdYdYr4J2qWqM/l5eZqc=
View all headers

Pascal Costanza wrote:

> Jeff Barnett wrote:
> > Does the Common Lisp spec say anything about whether the following is
> > well defined given that the elements of "list" are unique:
> >
> > (loop for x in list
> > when (p x)
> > do (setq list (delete x list)))
>
> See http://www.lispworks.com/documentation/HyperSpec/Body/03_f.htm
>
> But I wouldn't worry too much and just switch to a non-destructive version:
>
> (loop for x in list
> unless (p x) collect x into new-list
> finally (setq list new-list))

Gauche Scheme:

(remove odd? (iota 22))
===>
(0 2 4 6 8 10 12 14 16 18 20)

1

rocksolid light 0.9.8
clearnet tor