Deutsch   English   Français   Italiano  
<vahdhi$2cmjb$1@dont-email.me>

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

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: "B. Pym" <Nobody447095@here-nor-there.org>
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=
Bytes: 1448

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)