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: TheFlyingDutchman
Subject: Re: Add-to-list or setq append...
Date: Wed, 08 Dec 2010 15:23:04 -0000
User-agent: G2/1.0

> (setq list (append list element))
>
> 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?

The real problem to me is that anyone learning to append to a list
probably does not want to add an "element" to a list.

They would need to see:

(setq list (append list other-list))

That is one of the nice things about add-to-list - it allows you to
add an "element" (string, number, symbol)  and have the result still
be a list.

Checking for duplicates is not always wanted. However, you can do a
kludge to get around it by creating a compare function that always
returns nil


reply via email to

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