Sujet : Re: CAR/CDR vs FIRST/REST
De : 643-408-1753 (at) *nospam* kylheku.com (Kaz Kylheku)
Groupes : comp.lang.lispDate : 03. Jul 2024, 00:58:00
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20240702155524.692@kylheku.com>
References : 1
User-Agent : slrn/pre1.0.4-9 (Linux)
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/txrCygnal: Cygwin Native Application Library: http://kylheku.com/cygnalMastodon: @Kazinator@mstdn.ca