From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Florian Beck Newsgroups: gmane.emacs.help Subject: Re: Problem with position and find (cl) Date: Fri, 20 Jun 2008 22:14:05 +0200 Organization: T-Online Message-ID: <87hcbng8z6.fsf@sophokles.streitblatt.de> References: <6c2bb4F3dibi5U1@mid.individual.net> <6c2gf4F3eltftU1@mid.individual.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1213994601 15958 80.91.229.12 (20 Jun 2008 20:43:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 20 Jun 2008 20:43:21 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jun 20 22:44:05 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 1K9nSZ-0008U9-Qd for geh-help-gnu-emacs@m.gmane.org; Fri, 20 Jun 2008 22:43:52 +0200 Original-Received: from localhost ([127.0.0.1]:54112 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K9nRl-0003qS-4h for geh-help-gnu-emacs@m.gmane.org; Fri, 20 Jun 2008 16:43:01 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!goblin1!goblin.stu.neva.ru!newsfeed.straub-nv.de!newsfeed01.sul.t-online.de!newsmm00.sul.t-online.de!t-online.de!news.t-online.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 49 Original-X-Trace: news.t-online.com 1213992845 03 23443 9QTkOACL8lK7V40 080620 20:14:05 Original-X-Complaints-To: usenet-abuse@t-online.de X-ID: SINLLkZaQey2Fp4KbaGaP2TNJL4ddNLIzxbRwtit2A6XX4Xq2wzIEV User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) Cancel-Lock: sha1:o28fxfmSESup/qFDFD9J2XvFl/s= Original-Xref: news.stanford.edu gnu.emacs.help:159644 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:54994 Archived-At: 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)))) > > Maybe position and find (and maybe some others functions) > can not compare lists directly? They can, but again, the elements are not identical. Compare: (let* ((x '((1) (2) (3) (4))) (y (cadr x)) (z '(2))) (message "x: %s; y:%s" (position y x) (position z x))) y ist the same object as the cadr of x, z is an entirely new object that happens to have the same component. > > Marc -- Florian Beck