all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "rgb" <rbielaws@i1.net>
Subject: Re: sharing list structure
Date: 24 Mar 2005 17:01:29 -0800	[thread overview]
Message-ID: <1111712489.491757.194480@g14g2000cwa.googlegroups.com> (raw)
In-Reply-To: <mailman.173.1111709565.28103.help-gnu-emacs@gnu.org>

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.

       reply	other threads:[~2005-03-25  1:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.173.1111709565.28103.help-gnu-emacs@gnu.org>
2005-03-25  1:01 ` rgb [this message]
2005-03-25  1:42   ` sharing list structure Joe Corneli
     [not found]   ` <mailman.182.1111716692.28103.help-gnu-emacs@gnu.org>
2005-03-25  5:44     ` rgb
2005-03-25  5:49       ` rgb
2005-03-25  6:08       ` Joe Corneli
2005-03-24 23:48 Joe Corneli
2005-03-25  0:17 ` Denis Bueno
2005-03-25  0:27   ` Joe Corneli
2005-03-25  0:35     ` Denis Bueno
     [not found]   ` <mailman.176.1111711460.28103.help-gnu-emacs@gnu.org>
2005-03-25  1:21     ` Thien-Thi Nguyen
2005-03-26 23:58     ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1111712489.491757.194480@g14g2000cwa.googlegroups.com \
    --to=rbielaws@i1.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.