From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juanma Barranquero Newsgroups: gmane.emacs.devel Subject: Re: `remove-duplicates' Date: Sun, 10 Jul 2011 17:27:50 +0200 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1310311743 2127 80.91.229.12 (10 Jul 2011 15:29:03 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 10 Jul 2011 15:29:03 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jul 10 17:29:00 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QfvwJ-00013e-NI for ged-emacs-devel@m.gmane.org; Sun, 10 Jul 2011 17:28:59 +0200 Original-Received: from localhost ([::1]:41991 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QfvwH-0000c3-8c for ged-emacs-devel@m.gmane.org; Sun, 10 Jul 2011 11:28:57 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:54146) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qfvvv-0000bZ-G6 for emacs-devel@gnu.org; Sun, 10 Jul 2011 11:28:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qfvvr-00046J-Rc for emacs-devel@gnu.org; Sun, 10 Jul 2011 11:28:35 -0400 Original-Received: from mail-pz0-f41.google.com ([209.85.210.41]:43665) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qfvvr-00046F-Dz for emacs-devel@gnu.org; Sun, 10 Jul 2011 11:28:31 -0400 Original-Received: by pzk4 with SMTP id 4so2933329pzk.0 for ; Sun, 10 Jul 2011 08:28:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; bh=jzrqJykHmy5s2ivTcwKM/BcdjxjhJDZKJX4L01cEf+8=; b=Wt6NurCApLmPVofLMk/oL5C+SwaXAwQekJjdDC6lIGsREjHzSZKAOlcMzL6g0ZDlaD 9j/z2XIcPIWjN+qxLxG/P5QlnalrT+BBqXUhtK+AcIfYZHQ8Px4nt68Ic2JD0tuSa+vW ksw2P2Q1Gjab7+GehzZq7RJBg5/P2MyQevCtk= Original-Received: by 10.143.90.14 with SMTP id s14mr1577900wfl.138.1310311710187; Sun, 10 Jul 2011 08:28:30 -0700 (PDT) Original-Received: by 10.142.144.4 with HTTP; Sun, 10 Jul 2011 08:27:50 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.210.41 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:141908 Archived-At: On Sun, Jul 10, 2011 at 17:05, Lars Magne Ingebrigtsen wro= te: > Would anybody mind if I add a simple version of `remove-duplicates' to > subr.el? =C2=A0I'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)) =C2=A0 =C2=A0 Juanma