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

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

Re: using setq to create lists based on other lists...


From: Barry Margolin
Subject: Re: using setq to create lists based on other lists...
Date: Tue, 04 Dec 2018 04:00:32 -0500
User-agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X)

In article <mailman.5026.1543764670.1284.help-gnu-emacs@gnu.org>,
 Jean-Christophe Helary <brandelune@gmail.com> wrote:

> > On Dec 3, 2018, at 0:00, Stephen Berman <stephen.berman@gmx.net> wrote:
> > 
> > I think your confusion may be due to not distinguishing the value
> > assigned by setq, which is a particular object, and the form of the
> > value, which may look the same but nevertheless be a different object.
> 
> You are absolutely right.
> 
> But I think the "not distinguishing" the difference between the two is 
> partially caused by the way the Reference is written:
> 
> Global Variables:
> > You specify a value for a symbol with setq. For example, (setq x '(a b))
> > gives the variable x the value (a b).
> 
> This is not saying: gives the variable x a pointer to the object (a b)

There are no pointers in Lisp. There are just objects, the pointers are 
in the implementation.

The important thing is that

(setq list1 list2)

doesn't make a copy of the value of list2 when assigning to list1. The 
two variables refer to the same value when this is done.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


reply via email to

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