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:48 -0000
User-agent: Gnus/5.101 (Gnus v5.10.10) Emacs/23.2 (gnu/linux)

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

> Andrea Crotti <andrea.crotti.0@gmail.com> writes:
>
>> it actually not add it ONLY if they're really equal, which is desirable
>> in my opinion.
>> What's the point in having twice the same cons in auto-mode-alist?
>>
>> Then the real difference is that I add in the end instead of at the
>> beginning, and in that case I don't shadow an already present value...
>
> And also why not using some kind of union when merging two lists.
> There is a union defined in cl-seq, that for example would suffice the
> ugly double elements in the same list...

If union in cl-seq is implemented as specified by clhs, it doesn't
ensure that the resulting list will have unique elements (for the
given union criteria, which by the way, when involving :test-not
(inequalities in general) is rather hairy and un-obvious).

What is ensured is that for each pair (r,s) in R×S, only one of the
two elements of is in the result, which doesn't  mean much, because
the other element may be included in the result because of the result
of the test on another pair.


If you want a list with unique elements, you should use remove-duplicates.


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


reply via email to

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