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

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

`append' vs. `nconc' (was: Re: Error: Setting the shell in sh-mode via a


From: Emanuel Berg
Subject: `append' vs. `nconc' (was: Re: Error: Setting the shell in sh-mode via a local variable does not work)
Date: Wed, 30 Dec 2015 16:41:51 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Teemu Likonen <tlikonen@iki.fi> writes:

> There you create a list MODES and then APPEND copies
> the whole list and joins it to AUTO-MODE-ALIST.
> The original list is discarded. No problem, it's
> just a configuration code. But in some other
> situation it might be good idea to construct the
> list only once and use NCONC which only traverses
> the lists through and modifies last conses to join
> it to the next list:
>
>     (let ((modes (list '(a . b) ;; ... ))) (setq
> auto-mode-alist (nconc modes auto-mode-alist)))

So what you are saying, if `append' is replaced by
`nconc', the same thing happens, only one less list
has to be created?

I have several appends in my source, is there
a rule-of-thumb when to use `append' and when to use
`nconc'?

> The PROGN is redundant because LAMBDA has an implicit
> PROGN

OK, cool.

-- 
underground experts united
http://user.it.uu.se/~embe8573




reply via email to

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