bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Drew Adams
Subject: bug#12314: 24.2.50; `add-to-history': use `setq' with `delete'
Date: Sat, 8 Sep 2012 09:54:27 -0700

> > Even if the element is not the first one, you always have 
> > to think about other references that may exist to the
> > cons that is removed.
> 
> Sorry, I'm not sure how this is related.  Please elaborate.

(Think pointers.)  A variable stays pointed to the same cons cell - these
operations do not change that.  But they can change the relations among cons
cells: which of them point to which others.

(setq a  '(1 2 3 4))
(setq b  (cddr a))

a => (1 2 3 4)
b => (3 4)

(delq 4 b)

a => (1 2 3)
b => (3)

The value of variable `a' was changed by changing the value of `b', because `b'
points to a cons cell that is used in the list structure pointed to by `a'.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]