From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Hannu Koivisto Newsgroups: gmane.emacs.help Subject: Re: alist and multiple values for one key Date: Tue, 21 Jan 2003 01:53:58 +0200 Organization: NOYB Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <87iswjv0mh.fsf@lynx.ionific.com> References: <877kcz6c76.fsf@fbigm.here> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1043131393 1660 80.91.224.249 (21 Jan 2003 06:43:13 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 21 Jan 2003 06:43:13 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18as7r-0000Qe-00 for ; Tue, 21 Jan 2003 07:43:12 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18aqvi-0004VP-0A for gnu-help-gnu-emacs@m.gmane.org; Tue, 21 Jan 2003 00:26:34 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!cyclone.bc.net!newsfeed.media.kyoto-u.ac.jp!newsfeed.icl.net!newsfeed.fjserv.net!feed.news.nacamar.de!uio.no!newsfeed.song.fi!feeder1.news.jippii.net!feeder2.news.jippii.net!reader1.news.jippii.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 19 User-Agent: Gnus/5.090007 (Oort Gnus v0.07) Emacs/21.2 (i686-pc-linux-gnu) Cancel-Lock: sha1:ZX/OfLqA7p2TZ0v7W3NNsS0YhSU= Original-NNTP-Posting-Host: 195.197.252.71 Original-X-Complaints-To: newsmaster@saunalahti.com Original-X-Trace: reader1.news.jippii.net 1043106839 195.197.252.71 (Tue, 21 Jan 2003 01:53:59 EET) Original-NNTP-Posting-Date: Tue, 21 Jan 2003 01:53:59 EET Original-Xref: shelby.stanford.edu gnu.emacs.help:109275 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:5805 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:5805 Friedrich Dominicus 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