From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Denis Bueno Newsgroups: gmane.emacs.help Subject: Re: sharing list structure Date: Thu, 24 Mar 2005 19:35:50 -0500 Message-ID: <6dbd4d000503241635410430b0@mail.gmail.com> References: <6dbd4d00050324161731ef0f51@mail.gmail.com> Reply-To: Denis Bueno NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1111712406 13950 80.91.229.2 (25 Mar 2005 01:00:06 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 25 Mar 2005 01:00:06 +0000 (UTC) Cc: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Mar 25 02:00:06 2005 Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DEdBB-0003DK-MU for geh-help-gnu-emacs@m.gmane.org; Fri, 25 Mar 2005 02:00:02 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DEdQZ-000060-BH for geh-help-gnu-emacs@m.gmane.org; Thu, 24 Mar 2005 20:15:55 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DEdM5-0006TU-GP for help-gnu-emacs@gnu.org; Thu, 24 Mar 2005 20:11:17 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DEdLo-0006Lv-6v for help-gnu-emacs@gnu.org; Thu, 24 Mar 2005 20:11:03 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DEdLn-0006Ft-2C for help-gnu-emacs@gnu.org; Thu, 24 Mar 2005 20:10:59 -0500 Original-Received: from [64.233.184.197] (helo=wproxy.gmail.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DEcnn-0001BK-4z for help-gnu-emacs@gnu.org; Thu, 24 Mar 2005 19:35:51 -0500 Original-Received: by wproxy.gmail.com with SMTP id 55so1024414wri for ; Thu, 24 Mar 2005 16:35:50 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=CPFbdRFKtcHhwN8tq9E0MoeQSAxcFEohuIHgCupTODArUzWfVppl/gDaQjcso5TDh936dCotNpUh7Q8UarJqciP61Wuc4scoRHeY7T0cFcTmO+3SPjKb98z3gXVBgER3Z/bhoQvPCPJSdtiyApGiHn/kNPBqhigVWWNf8pXloaQ= Original-Received: by 10.54.94.15 with SMTP id r15mr701046wrb; Thu, 24 Mar 2005 16:35:50 -0800 (PST) Original-Received: by 10.54.43.7 with HTTP; Thu, 24 Mar 2005 16:35:50 -0800 (PST) Original-To: Joe Corneli In-Reply-To: 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 X-MailScanner-To: geh-help-gnu-emacs@m.gmane.org Xref: news.gmane.org gmane.emacs.help:25129 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:25129 On Thu, 24 Mar 2005 18:27:28 -0600, Joe Corneli wrote: > The `append' doesn't alter the structure of the list A. > > (defvar *foo* (list 1 2 3)) > (append *foo* (list 4 5 6)) > *foo* => (1 2 3) > > Hence, the result of append doesn't alter A's structure. > > Note the `setq' above, which make it look an awful lot like the > structure of A *is* being modified. I mean, it comes out as a > different list -- The setq modifies what the value of the symbol A is - it's destructive in that sense. After the setq, instead of being (1 2 3), A's value to the list (1 2 3 4). But it's a different list (in memory) from its former value. > So, just restrict yourself to destructive operations on A - like > setcdr, setcar, etc. - and you'll be set. Just note that A will always > have to be the "tail" part of B. > > OK, I think I've got the idea now. But still, I'm surprised that `setq' > is not among the list of "destructive functions". What's that about? Like I said, the difference is in just _what_ it's destructively modifying. In the case above, it destructively modifies the value of the symbol A (see `symbol-value'), not the structure of the list whose head cons cell is the value of the symbol A (which is just a more precise way of saying "the list A"). -- Denis Bueno PGP: http://pgp.mit.edu:11371/pks/lookup?search=0xA1B51B4B&op=index