Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

BOFH excuse #19: floating point processor overflow


comp / comp.lang.lisp / Re: CAR/CDR vs FIRST/REST

SubjectAuthor
* Re: CAR/CDR vs FIRST/RESTB. Pym
`- Re: CAR/CDR vs FIRST/RESTKaz Kylheku

1
Subject: Re: CAR/CDR vs FIRST/REST
From: B. Pym
Newsgroups: comp.lang.lisp
Organization: A noiseless patient Spider
Date: Thu, 12 Sep 2024 17:59 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: CAR/CDR vs FIRST/REST
Date: Thu, 12 Sep 2024 17:59:57 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <vbva6t$c0o9$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Injection-Date: Thu, 12 Sep 2024 19:59:58 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="6ef1a697af509b05826cc192b1c954d6";
logging-data="393993"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Am5icaR9JOljZ+5SHoYio"
User-Agent: XanaNews/1.18.1.6
Cancel-Lock: sha1:jVTCv7cuOiXxV1onjUWL+MK9lF8=
View all headers

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)

Does using "loop" cripple the brain, or do only those
with crippled brains use "loop"?

Subject: Re: CAR/CDR vs FIRST/REST
From: Kaz Kylheku
Newsgroups: comp.lang.lisp
Organization: A noiseless patient Spider
Date: Fri, 13 Sep 2024 00:47 UTC
References: 1
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 643-408-1753@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.lisp
Subject: Re: CAR/CDR vs FIRST/REST
Date: Fri, 13 Sep 2024 00:47:57 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 32
Message-ID: <20240912174404.730@kylheku.com>
References: <vbva6t$c0o9$1@dont-email.me>
Injection-Date: Fri, 13 Sep 2024 02:47:58 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="99dc7076b0b49591e69cd20e1421cb3c";
logging-data="540159"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/51JhD79hY9UC+lR86Ke+5oOzR2ihreXA="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:nzXut6ovCy+TzGFUduCVMoDRoec=
View all headers

On 2024-09-12, B. Pym <Nobody447095@here-nor-there.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)

Also, once you realize that "remove-if-not" is "keep-if":

(remove-if-not #'numberp list)

then you also will not use the poor "idiom":

(mapcan #'(lambda (x) (and (numberp x) (list x))) list)

Not to mention that once you learn that (lambda ...) is
a macro which writes #'(lambda ...) for you, you will tend
not to use the latter again.

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

1

rocksolid light 0.9.8
clearnet tor