GNU bug report logs - #50928
remove-dups

Previous Next

Package: emacs;

Reported by: Tak Kunihiro <tkk <at> misasa.okayama-u.ac.jp>

Date: Fri, 1 Oct 2021 03:25:01 UTC

Severity: wishlist

Tags: notabug

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #21 received at 50928 <at> debbugs.gnu.org (full text, mbox):

From: Thierry Volpiatto <thievol <at> posteo.net>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>,
 Tak Kunihiro <tkk <at> misasa.okayama-u.ac.jp>,
 "50928 <at> debbugs.gnu.org" <50928 <at> debbugs.gnu.org>,
 Dmitry Gutov <dgutov <at> yandex.ru>
Subject: Re: bug#50928: [External] : bug#50928: remove-dups
Date: Fri, 01 Oct 2021 17:31:53 +0000
Drew Adams <drew.adams <at> oracle.com> writes:

> FWIW, I use this.  I don't recall whether I borrowed
> it from somewhere or just wrote it from scratch.
>
> (defun my-remove-dups (sequence &optional test)
>   "Copy of SEQUENCE with duplicate elements removed.
> Optional arg TEST is the test function.  If nil, test with `equal'.
> See `make-hash-table' for possible values of TEST."
>   (setq test  (or test  #'equal))
>   (let ((htable  (make-hash-table :test test)))
>     (loop 
>      for elt in sequence
>      unless (gethash elt htable)
       collect (puthash elt elt htable))))

Looks like a old version of `helm-fast-remove-dups`, no need to loop
again in hash-table and using cl-loop is better.

-- 
Thierry




This bug report was last modified 3 years and 292 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.