Subject: RE: bug#12314: 24.2.50; `add-to-history': use `setq' with `delete'

From: "Drew Adams" <[email-masked]>
Date: Sat, 8 Sep 2012 23:29:10 -0700

> > The fact that modifying the list pointed to by `b' also 
> > modifies the list pointed to by `a' is an advantage for
> > certain kinds of programs.
> 
> I fail to see the utility of this.  Building code that relies on
> internal implementation details is never a good idea.  But that's me;
> please don't bother to argue.

Intentional list modification is not an implementation detail.  That is, it
concerns the implementation of your program, of course, but not the
implementation of Lisp itself.  You have to know what a given Lisp operation
does (side effects) and what it returns, but not how it is implemented.

My description of this area apparently did not help you.
Perhaps someone else can do better.

You might start here: (elisp) `Modifying Lists'.
You might search there for "share|sharing".

You might also google for, say, "lisp sharing list structure modification".
Looking at some of the hits, I think several should be helpful.

Here's one that might be another place to start:
http://en.wikipedia.org/wiki/Lisp_(programming_language)#Shared_structure

Perhaps you can imagine a complex program with a humongous graph structure
(already you see some sharing), which is dynamically modified.  Imagine
different views (e.g., variables) into various parts of that structure.  This
kind of Lisp program is not uncommon in some applications.  (The same could be
done using Java or C or whatever, but Lisp is good for doing things with lists.)

Lisp is not a purely functional language.  You need not like that, and you are
not forced to use `setf' etc. when programming in Lisp.  But such operations are
a part of Lisp, and they are used by some Lisp programs.  They are not a
mistake, but it is possible to make mistakes when using them.