From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "rgb" Newsgroups: gmane.emacs.help Subject: Re: sharing list structure Date: 24 Mar 2005 17:01:29 -0800 Organization: http://groups.google.com Message-ID: <1111712489.491757.194480@g14g2000cwa.googlegroups.com> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: sea.gmane.org 1111712679 14516 80.91.229.2 (25 Mar 2005 01:04:39 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 25 Mar 2005 01:04:39 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Mar 25 02:04:39 2005 Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DEdFZ-0003ld-9L for geh-help-gnu-emacs@m.gmane.org; Fri, 25 Mar 2005 02:04:33 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DEdUx-0004Ku-4H for geh-help-gnu-emacs@m.gmane.org; Thu, 24 Mar 2005 20:20:27 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!g14g2000cwa.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 39 Original-NNTP-Posting-Host: 198.74.20.78 Original-X-Trace: posting.google.com 1111712493 3412 127.0.0.1 (25 Mar 2005 01:01:33 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Fri, 25 Mar 2005 01:01:33 +0000 (UTC) In-Reply-To: User-Agent: G2/0.2 Complaints-To: groups-abuse@google.com Injection-Info: g14g2000cwa.googlegroups.com; posting-host=198.74.20.78; posting-account=C7LM4w0AAAD23IRuMuUUJVCLQTuHhTK8 Original-Xref: shelby.stanford.edu gnu.emacs.help:129579 Original-To: help-gnu-emacs@gnu.org 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:25130 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:25130 Joe Corneli wrote: > I'm not sure how to do the following: > > I have a list A, that grows, shrinks, and changes. > > I want to have a list B that includes list A within > its list structure, along with other things, and that > automatically keeps the "A" part of itself in synch > with A. > There will certainly be some kid gloves involved because most of the normal things you might want to do with A are destructive or subversive to any pointer B might hold. The reason is, B is a symbol in an obarray that points to a list element. That list element might have a CDR which points to the same list element that A points to but a change to A list can never cause the pointer held by some element in list B to change. So any operation involving setq A will very likely cause the corresponding pointer in list B to point to an obsolete location. > Is there a way to accomplish this? And if it can't be done with > list structure alone, what other suggestions can you make? I'm pretty sure this is not what you are looking for since the position of the contents of B within list A is fixed. (defmacro a+b () '`(,@A ,@B)) ;or any number of similar things (setq A '(a b c d)) (setq B '(1 2 3 4)) (a+b) => (a b c d 1 2 3 4) (setq a '(w x y z)) (setq b '(9 8 7 6)) (a+b) => (w x y z 9 8 7 6) To be honest, I can't think of a way to do what it seems you want in *any* language. But maybe I don't really understand.