|
From: | Hannu Koivisto |
Subject: | Re: alist and multiple values for one key |
Date: | Tue, 21 Jan 2003 01:53:58 +0200 |
User-agent: | Gnus/5.090007 (Oort Gnus v0.07) Emacs/21.2 (i686-pc-linux-gnu) |
Friedrich Dominicus <frido@q-software-solutions.com> writes: > This code will work for the given data: > (defun collect-if (pred list) > (mapcar #'(lambda (el) (when (funcall pred el) el)) list)) > > you can call it with > (collect-if #'(lambda (item) (eq (car item) 'pine)) trees) > > ((pine . cones) (pine . acorns)) I'm afraid that is not what your example expression evaluates to. Did you try it? Learn about mapcan if you want to get your code right using one of the map... functions. Of course, to return just the values as requested by the OP you will need other changes as well. -- Hannu
[Prev in Thread] | Current Thread | [Next in Thread] |