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

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

Re: Add-to-list or setq append...


From: Pascal J. Bourguignon
Subject: Re: Add-to-list or setq append...
Date: Wed, 08 Dec 2010 15:22:41 -0000
User-agent: Gnus/5.101 (Gnus v5.10.10) Emacs/23.2 (gnu/linux)

Andrea Crotti <andrea.crotti.0@gmail.com> writes:

> Just a curiosity, I was wondering why in so many README and doc they
> suggest to add elements to lists with something like:
>
> --8<---------------cut here---------------start------------->8---
> (setq list (append list element))
> --8<---------------cut here---------------end--------------->8---
>
> instead of doing simply
> --8<---------------cut here---------------start------------->8---
> (add-to-list list-va element)
> --8<---------------cut here---------------end--------------->8---
>
> Is there any good reason or is just historical heritage?
> I think add-to-list is even more smart adding only if not there already,
> then what's the point in using that ugly form?

I would rather use:

(require 'cl)
(pushnew element list-va)

than add-to-list.


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/


reply via email to

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