emacs-devel
[Top][All Lists]
Advanced

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

Re: `remove-duplicates'


From: Juanma Barranquero
Subject: Re: `remove-duplicates'
Date: Sun, 10 Jul 2011 17:27:50 +0200

On Sun, Jul 10, 2011 at 17:05, Lars Magne Ingebrigtsen <address@hidden> wrote:

> Would anybody mind if I add a simple version of `remove-duplicates' to
> subr.el?  I'm tired of rewriting the same loop...

I think there are also quite a few cases in the sources of destructive
deleting of *consecutive* duplicates. I once proposed this:

(defun uniqify (list)
 "Destructively remove consecutive `equal' duplicates from LIST.
Store the result in LIST and return it.  LIST must be a proper list."
 (let ((l list))
   (while (cdr l)
     (if (equal (car l) (cadr l))
         (setcdr l (cddr l))
       (setq l (cdr l))))
   list))

    Juanma



reply via email to

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