all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juanma Barranquero <lekktu@gmail.com>
To: emacs-devel@gnu.org
Subject: Re: `remove-duplicates'
Date: Sun, 10 Jul 2011 17:27:50 +0200	[thread overview]
Message-ID: <CAAeL0ST=+SE32aaMiC1xC9J_pg=gwsrR3cwUAuGgoANBCuep_A@mail.gmail.com> (raw)
In-Reply-To: <m3wrfqb2gs.fsf@quimbies.gnus.org>

On Sun, Jul 10, 2011 at 17:05, Lars Magne Ingebrigtsen <larsi@gnus.org> 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	other threads:[~2011-07-10 15:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-10 15:05 `remove-duplicates' Lars Magne Ingebrigtsen
2011-07-10 15:27 ` Juanma Barranquero [this message]
2011-07-10 16:06   ` `remove-duplicates' David Kastrup
2011-07-10 16:37     ` `remove-duplicates' Drew Adams
2011-07-12  3:48 ` `remove-duplicates' Stefan Monnier
2011-07-12  7:22   ` `remove-duplicates' Lars Magne Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAAeL0ST=+SE32aaMiC1xC9J_pg=gwsrR3cwUAuGgoANBCuep_A@mail.gmail.com' \
    --to=lekktu@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.