Re: I still don't get MAPCAN

Liste des GroupesRevenir à cl lisp 
Sujet : Re: I still don't get MAPCAN
De : Nobody447095 (at) *nospam* here-nor-there.org (B. Pym)
Groupes : comp.lang.lisp
Date : 27. Jun 2025, 00:09:37
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <103kjvg$3nlhj$1@dont-email.me>
User-Agent : XanaNews/1.18.1.6
Ken Tilton wrote:

MAPCAN is terribly useful when you want to collect only some things:
>
(defun find-interesting (huge-list)
 (mapcan #'(lambda (e) (if (interestingp e) (list e) nil)) huge-list))


Why wasn't it simply:

(mapcan (lambda (e) (if (interestingp e) (list e) nil)) huge-list))

Users of CL (COBOL-Like) are extremely eager to make their
code as ugly as possible.


 
ick.
 
  (loop for e in huge-list when (interestingp e) collect e)

Ick.

Scheme:

(filter interesting? huge-list)

Date Sujet#  Auteur
27 Jun 25 * Re: I still don't get MAPCAN2B. Pym
27 Jun 25 `- Re: I still don't get MAPCAN1B. Pym

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal