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

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

Re: Appending lists


From: Emanuel Berg
Subject: Re: Appending lists
Date: Thu, 17 Jun 2021 01:19:57 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Jean Louis wrote:

> (let* ((list-1 '(a b c))
>         (list-2 (nconc list-1 '(1 2 3))))
>    (eq list-1 list-2)) ;; => t
>
> eq - Return t if the two args are the same Lisp object.
>
> And we talked how variable's value does not change... values
> or Lisp objects?

Again, the value, a reference to a cons cell, doesn't change.

Here I think what's demonstrated is that list-1 and list-2 are
the same, i.e. they both hold references to the same
cons cell. It seems `nconc' returns a reference to the first
cons sell of the new list, which is the first of list-1 as
well; and the new list was created by changing the cdr of
list-1's last element so that instead of holding nil (denoting
the end of the list) it holds a reference to the first cons
cell of "list-2"...

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

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