Deutsch   English   Français   Italiano  
<20240702155524.692@kylheku.com>

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

Path: ...!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Kaz Kylheku <643-408-1753@kylheku.com>
Newsgroups: comp.lang.lisp
Subject: Re: CAR/CDR vs FIRST/REST
Date: Tue, 2 Jul 2024 22:58:00 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 29
Message-ID: <20240702155524.692@kylheku.com>
References: <v61rmv$1q5l1$1@dont-email.me>
Injection-Date: Wed, 03 Jul 2024 00:58:00 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="30e244ac737476d78edd2cd6194d0a15";
	logging-data="1933073"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/i6KzrDEGH7kiaRLDLbVs77NYQxlXLw0c="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:Axg+FEKq7jtfBLuzh+9Yf8pmqQo=
Bytes: 1598

On 2024-07-02, B. Pym <No_spamming@noWhere_7073.org> wrote:
> Barry Margolin wrote:
>
>> >       (mapcan #'(lambda (x) (and (numberp x) (list x))) list)
>> 
>> >       (loop for x in list
>> >               when (numberp x) collect x)
>> 
>> I agree with this example.  Once I learned LOOP I never used the
>> above idiom again.
>
>
> (filter number? '(a b c 1 2 3))
> ===>
> (1 2 3)

In Common Lisp, filter has a funny name: remove-if-not.

  (remove-if-not #'numberp '(a b c 1 2 3))
  -->
  (1 2 3)

Likely because of the funny name, the function is marked deprecated,
which is silly.

-- 
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca