[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#50928: [External] : bug#50928: remove-dups
From: |
Thierry Volpiatto |
Subject: |
bug#50928: [External] : bug#50928: remove-dups |
Date: |
Fri, 01 Oct 2021 17:31:53 +0000 |
Drew Adams <drew.adams@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