[Top][All Lists]

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

Re: append, push, and add-to-list.

From: Emanuel Berg
Subject: Re: append, push, and add-to-list.
Date: Mon, 05 Jul 2021 05:48:23 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Hongyi Zhao wrote:

> On Mon, Jul 5, 2021 at 12:19 AM Emanuel Berg via Users list for the
> GNU Emacs text editor <> wrote:
>> Hongyi Zhao wrote:
>> > I've noticed there are some similar functions, i.e., append,
>> > push, and add-to-list, for revising/updating the content of
>> > a list. But I'm still not so clear on the specific use
>> > scenarios for them. Consider the following command [1]
>> `nconc', `cl-pushnew', (setq lst `(,@lst el)) ...
> Does the following append `el' to `lst'?
> (setq lst `(,@lst el))

Yes, literally, but maybe it makes more sense if that is
evaluated as well?

(defvar lst)
(setq lst '(a b c))

(defvar el)
(setq el 4)

(setq lst `(,@lst ,el))

Now "lst" will be (a b c 4)

> This is one of the reasons that baffles me the most - there
> are so many functions in Emacs.

The more the merrier...

underground experts united

reply via email to

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