emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: CC mode loads CL


From: Kim F. Storm
Subject: Re: CC mode loads CL
Date: 11 Feb 2004 11:51:58 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

address@hidden (Karl Heuer) writes:

> Dave Love <address@hidden> writes:
> >Luc Teirlinck <address@hidden> writes:
> >> I installed the non-consing version of `delete-dups' and added an item
> >> to the NEWS.
> >
> >[That seems a rather unfortunate name/implementation to me.]
> 
> I'll withhold opinion on the name, but as for the implementation...
> 
> In keeping with the earlier suggestion that it's better to keep
> the first of any duplicated elements rather than the last, I
> propose the following implementation, which satisfies that
> requirement and is also simpler.

And probably a good deal faster too as delete is a built-in.

IMO, we should definitely use this version instead of the current.
Luc?

> 
> (defun delete-dups (list)
>     "Destructively return LIST, with `equal' duplicates removed.
> LIST must be a proper list.  Of several `equal' occurrences of an
> element in LIST, the first one is kept."
>   (let ((tail list))
>     (while tail
>       (setcdr tail (delete (car tail) (cdr tail)))
>       (setq tail (cdr tail))))
>   list)

-- 
Kim F. Storm  http://www.cua.dk





reply via email to

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