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: Wed, 16 Jun 2021 03:11:43 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

tomas wrote:

> (setq thing (copy-sequence '(one two three four five six)))
> (setq thang (cddr thing))
>
> thang => (three four five six)
>
> (nreverse thing) => (six five four three two one)
>
> thing => (one)
>
> thang => (three two one)
>   ; now this is what I was after. Who the heck "changed my
>   ; variable!?" Who is General Failure and why is he reading
>   ; my disk?

Well, let's see, `nreverse' has updated the data without
setting the variables to whatever desired values they should
take so what is left is the variables reference to the first
data item (the car), after that tho 1 doesn't have a cdr
anymore and 3 has '(2 1), not '(4 5 6).

?

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




reply via email to

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