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

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

Appending lists


From: henri-biard
Subject: Appending lists
Date: Tue, 15 Jun 2021 03:47:57 +0200 (CEST)

>> Pierpaolo Bernardi wrote:



>> (defvar newlist 
>> (append city district))



>> Emanuel Berg
> Looks - bad.



Now I am really getting wound up !



Should I use (append city district) or (list city district) ?



Using defvar seemed good enough for me. 



Anyway, concatenating all the arguments in "append" make the result a list.





From: Emanuel Berg via Users list for the GNU Emacs text editor 
<help-gnu-emacs@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: Appending lists
Date: 15/06/2021 02:56:16 Europe/Paris

Pierpaolo Bernardi wrote:

> (defvar newlist 
> (append city district))

Looks - bad.

Forget about the initvalue, here people will have to agree to
disagree tho. It makes development less "athletic" and fun,
and more confusing when debugging/optimization and so re-eval
start. Instead, use `defvar' to mute the byte-compiler then on
the next line use `setq'. IOM!

newlist - bad name

> Il giorno 14 giugno 2021, alle ore 18:40,
> henri-biard@francemel.fr ha scritto:
>
> I want to make a new list named newlist to be
>
> (append city district)
>
> and put the new list into a new list.

There are many ways to do that. For example

(setq list-one '(1 2)) ; (1 2)
(setq list-one-two-times (list list-one list-one)) ; ((1 2) (1 2))
(setq list-one '(1 2 3)) ; (1 2 3)
list-one-two-times ; ((1 2) (1 2)) <-- still

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





reply via email to

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