From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thierry Volpiatto Newsgroups: gmane.emacs.help Subject: Re: Problem with position and find (cl) Date: Fri, 20 Jun 2008 23:24:02 +0200 Message-ID: <87wskjyf4d.fsf@thievol.homelinux.org> 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 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1213996732 22375 80.91.229.12 (20 Jun 2008 21:18:52 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 20 Jun 2008 21:18:52 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Florian Beck Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jun 20 23:19:36 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 1K9o17-0002xo-4q for geh-help-gnu-emacs@m.gmane.org; Fri, 20 Jun 2008 23:19:33 +0200 Original-Received: from localhost ([127.0.0.1]:49925 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K9o0I-0008JE-2N for geh-help-gnu-emacs@m.gmane.org; Fri, 20 Jun 2008 17:18:42 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K9nzz-0008Iy-NJ for help-gnu-emacs@gnu.org; Fri, 20 Jun 2008 17:18:23 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K9nzy-0008IJ-QE for help-gnu-emacs@gnu.org; Fri, 20 Jun 2008 17:18:23 -0400 Original-Received: from [199.232.76.173] (port=53322 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K9nzy-0008IA-Nj for help-gnu-emacs@gnu.org; Fri, 20 Jun 2008 17:18:22 -0400 Original-Received: from yw-out-1718.google.com ([74.125.46.158]:48210) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1K9nzy-0001HI-He for help-gnu-emacs@gnu.org; Fri, 20 Jun 2008 17:18:22 -0400 Original-Received: by yw-out-1718.google.com with SMTP id 9so672367ywk.66 for ; Fri, 20 Jun 2008 14:18:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:references :date:in-reply-to:message-id:user-agent:mime-version:content-type :content-transfer-encoding; bh=/9GbiGHvyBszZSXc3qrXwo5bkoBSQvW7VkKB1JOpcb0=; b=Gqk/TIWDbWnNdeeXRU2K411I90wuvvikr8+/nv/XoyOJJCb/DBV+p8E+ZDscokJ1HJ Y7XYj/EmXTR52aUvU+VFvch6Dp+N87w4BYDkVV/Tm2ylC3T/U+3fKZdIaDJNSIRbWUDh gNllmH244cijoJQjHrEZZkJ/iRD0tWzbj4GIk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type:content-transfer-encoding; b=vGWMMQcnZo+0gECN4DT/XKZQOCASmvZEgSgfTC6OjevwZEU5enNvqTXpuzlJA/S4nU VHzb6YifBBjfcAPFre5Ln5J69y0P7PbxYz6MrIXAhb2prjEsqAAmnL1rcrwGGc7q08tl w+NKc/G9syI3VcuJmLWV3VhcYODIJCn4mhdog= Original-Received: by 10.142.99.21 with SMTP id w21mr1934931wfb.55.1213996696511; Fri, 20 Jun 2008 14:18:16 -0700 (PDT) Original-Received: from thievol.homelinux.org ( [77.197.77.55]) by mx.google.com with ESMTPS id c53sm3147728wrc.28.2008.06.20.14.18.14 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 20 Jun 2008 14:18:15 -0700 (PDT) In-Reply-To: <87hcbng8z6.fsf@sophokles.streitblatt.de> (Florian Beck's message of "Fri, 20 Jun 2008 22:14:05 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) 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:54996 Archived-At: Florian Beck writes: > Marc Tfardy writes: > >> Marc Tfardy schrieb: >>> I try with: >>> (member '(2) '((1) (2) (3) (4))) > > `member' tests the components: =E2=80=BA2=E2=80=B9 ist always equal (in t= he sense of =C2=BBeq=C2=AB) to =E2=80=BA2=E2=80=B9 > > 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 =C2=BB(2)=C2=AB have the same component= s 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. > > position default test is 'eq, try 'equal ,---- | ELISP> (let* ((x '((1) (2) (3) (4))) | (y (cadr x)) | (z '(2))) | (message "x: %s; y:%s" (position y x) (position z x :test 'equal))) | "x: 1; y:1" `---- --=20 A + Thierry Pub key: http://pgp.mit.edu