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: Richard Stallman
Subject: Re: CC mode loads CL
Date: Tue, 17 Feb 2004 12:26:24 -0500

       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.  (Note that since the first
       element of the list is always a "keeper", the modified list is
       always the same as the return value, and it's no longer strictly
       necessary for the caller to wrap this in a setq.)

       (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)

I asked someone to install this.  You can install it if you want.




reply via email to

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