Re: CAR/CDR vs FIRST/REST

Liste des GroupesRevenir à cl lisp 
Sujet : Re: CAR/CDR vs FIRST/REST
De : 643-408-1753 (at) *nospam* kylheku.com (Kaz Kylheku)
Groupes : comp.lang.lisp
Date : 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/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca

Date Sujet#  Auteur
2 Jul 24 * Re: CAR/CDR vs FIRST/REST2B. Pym
3 Jul 24 `- Re: CAR/CDR vs FIRST/REST1Kaz Kylheku

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal