From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Marc Tfardy Newsgroups: gmane.emacs.help Subject: Re: Problem with position and find (cl) Date: Sat, 21 Jun 2008 12:07:02 +0200 Message-ID: <6c4268F3eh5teU1@mid.individual.net> References: <6c2bb4F3dibi5U1@mid.individual.net> <6c2gf4F3eltftU1@mid.individual.net> <87hcbng8z6.fsf@sophokles.streitblatt.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1214045057 900 80.91.229.12 (21 Jun 2008 10:44:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 21 Jun 2008 10:44:17 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Jun 21 12:45:01 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KA0aY-0003Ul-3R for geh-help-gnu-emacs@m.gmane.org; Sat, 21 Jun 2008 12:44:58 +0200 Original-Received: from localhost ([127.0.0.1]:39167 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KA0Zh-0004Gd-R9 for geh-help-gnu-emacs@m.gmane.org; Sat, 21 Jun 2008 06:44:06 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 49 Original-X-Trace: individual.net hok5mhzTLswnh7qn7W5k9QUf8e/3MmuVvIJTW5DDzHpne4eT+O Cancel-Lock: sha1:hECmHOwcBJxKisPkKPKVaWjGKSw= User-Agent: Thunderbird 2.0.0.14 (Windows/20080421) In-Reply-To: Original-Xref: news.stanford.edu gnu.emacs.help:159669 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:55023 Archived-At: Thierry Volpiatto schrieb: > Florian Beck writes: > >> Marc Tfardy writes: >> >>> Marc Tfardy schrieb: >>>> I try with: >>>> (member '(2) '((1) (2) (3) (4))) >> `member' tests the components: ›2‹ ist always equal (in the sense of »eq«) to ›2‹ >> >> Compare: >> >> (memq '(2) '((1) (2) (3) (4))) >> (eq 2 2) >> (eq '(2) '(2)) >> >>>> and this gives a expectet results ((2) (3) (4)), but: >>>> (find '(2) '((1) (2) (3) (4))) >>>> or >>>> (position '(2) '((1) (2) (3) (4))) >>>> >>>> returns nil. Why? >> Because the first and the second »(2)« have the same components but are >> *different* lists. >> >>> But this works: >>> >>> (position '(2) '((1) (2) (3) (4)) :test (lambda (x y) (eq (car x) (car >>> y)))) >>> > position default test is 'eq, try 'equal Thanks! It works with equal. But I have another problem. find (and find-if) returns only first match. Is there another function that returns all matched elements. Some example: (find-if-all (lambda (x) (if (eq (nth 2 x) 'byte) t nil)) '((1.1 "x" int) (2.2 "y" byte) (3.3 "q" int) (4.4 "b" byte) (5.5 "a" float))) should returns: ((2.2 "y" byte) (4.4 "b" byte)) I found in cl-*.el nothing like this. Any hints? regards Marc