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

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

RE: [External] : Re: List not getting filled up


From: Drew Adams
Subject: RE: [External] : Re: List not getting filled up
Date: Mon, 31 Jul 2023 01:40:57 +0000

> Upon further introspection I found that it makes a lot of difference
> whether I use
> 
> (push (copy-sequence string) result)
> or
> (push string result)
> 
> Why is that ?

Because of just what everyone's been saying:

If you add the string to the list then you
add the same string each time, because the
variable `string' refers to the same Lisp
object (same string), as shown by `eq'.

If you add a copy of the string the copy
reflects the current state of the string.

As I wrote:
(eq foo (copy-sequence foo)) ; -> nil




reply via email to

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