From: Nordlöw <per.nordlow@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Wanted: mapcar() without nils
Date: Sat, 13 Jun 2009 12:45:06 -0700 (PDT) [thread overview]
Message-ID: <2ec176d0-8eb4-4206-b830-2cbeb838aff6@t16g2000yqi.googlegroups.com> (raw)
In-Reply-To: 0bcb89f3-ac4d-41b4-8ed6-c10301a99afa@b9g2000yqm.googlegroups.com
Oopps, my mistake got a parenthesis wrong...
Now it works:
(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)))
;; Use: (extract-elements 'symbolp '(a b 1 2)) => '(a b)
;; Use: (extract-elements 'numberp '(a b 1 2)) => '(1 2)
Thanks,
Nordlöw
next prev parent reply other threads:[~2009-06-13 19:45 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-13 12:19 Wanted: mapcar() without nils Nordlöw
2009-06-13 12:47 ` Lennart Borgman
[not found] ` <mailman.562.1244897231.2239.help-gnu-emacs@gnu.org>
2009-06-13 18:24 ` Nordlöw
2009-06-13 19:05 ` Thierry Volpiatto
[not found] ` <mailman.581.1244920367.2239.help-gnu-emacs@gnu.org>
2009-06-13 19:33 ` Nordlöw
2009-06-13 19:45 ` Nordlöw [this message]
2009-06-13 19:43 ` Lennart Borgman
2009-06-13 20:02 ` Drew Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2ec176d0-8eb4-4206-b830-2cbeb838aff6@t16g2000yqi.googlegroups.com \
--to=per.nordlow@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.