help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Wanted: mapcar() without nils


From: Lennart Borgman
Subject: Re: Wanted: mapcar() without nils
Date: Sat, 13 Jun 2009 21:43:28 +0200

You misplaced a closing paren in the lambda

On Sat, Jun 13, 2009 at 8:24 PM, Nordlöw<per.nordlow@gmail.com> wrote:
> (defun extract-elements (pred seq)
>  "Extract a copy of SEQ containing all elements fullfilling
> PRED."
>  (delq nil (mapcar `(lambda (elm) (when (,pred elm)) elm) seq)))

 (delq nil (mapcar `(lambda (elm) (when (,pred elm) elm)) seq)))

> ;; Use: (extract-elements 'symbolp '(a b 1 2)) => '(a b)
> ;; Use: (extract-elements 'numberp '(a b 1 2)) => '(1 2)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]