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

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

Re: [External] : Re: Appending lists


From: Emanuel Berg
Subject: Re: [External] : Re: Appending lists
Date: Mon, 21 Jun 2021 02:29:37 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Jean Louis wrote:

> Not like that, you have to use `copy-sequence' on the last
> element within `append'
>
> (progn
>   (setq list-head '(1))
>   (setq list-tail '(2 3 4))
>   (setq whole-list (append list-head (copy-sequence list-tail)))
>   (setcdr list-tail '(3.5 4))
>   whole-list
> ) ; (1 2 3 4)

Clearly doesn't work:

(progn
   (setq list-head '(1))
   (setq list-tail '(2 3 4))
   (setq whole-list (append list-head
                            `(,(car list-tail))
                            (setcdr (copy-sequence list-tail) '(3.5 4))))
   whole-list
 ) ; (1 2 3.5 4)

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




reply via email to

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