Sujet : Re: Lis(t|p) comprehensions
De : anthk (at) *nospam* disroot.org (Bozo User)
Groupes : rec.puzzlesDate : 11. Sep 2024, 08:04:45
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vbrfec$3flij$1@dont-email.me>
References : 1
User-Agent : slrn/1.0.3 (Linux)
On 2024-09-08, B. Pym <
Nobody447095@here-nor-there.org> wrote:
CL-USER> [x (x <- '(1 2 3)) (oddp x)]
(1 3)
>
CL-USER> (loop for x in (list 1 2 3) when (oddp x) collect x)
(1 3)
LOOP does some kind of list comprehension aswell, without an additional
software.
>
Scheme:
>
(filter odd? '(3 4 5))
===>
(3 5)
>
Does using CL cripple the brain, or does having a crippled brain
cause one to use CL?
>
If Lisp is to live, CL must die.
(defun filter (func lst)
(remove-if-not func lst))
( filter #'oddp '(3 4 5 ))
(3 5)