From: Thierry Volpiatto <thievol@posteo.net>
To: Drew Adams <drew.adams@oracle.com>
Cc: Lars Ingebrigtsen <larsi@gnus.org>,
Tak Kunihiro <tkk@misasa.okayama-u.ac.jp>,
"50928@debbugs.gnu.org" <50928@debbugs.gnu.org>,
Dmitry Gutov <dgutov@yandex.ru>
Subject: bug#50928: [External] : bug#50928: remove-dups
Date: Fri, 01 Oct 2021 17:31:53 +0000 [thread overview]
Message-ID: <87fstk648m.fsf@posteo.net> (raw)
In-Reply-To: <CO6PR10MB54731E00BD7A9D4D3194E4E0F3AB9@CO6PR10MB5473.namprd10.prod.outlook.com> (Drew Adams's message of "Fri, 1 Oct 2021 17:02:08 +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
next prev parent reply other threads:[~2021-10-01 17:31 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-01 3:23 bug#50928: remove-dups Tak Kunihiro
2021-10-01 12:45 ` Lars Ingebrigtsen
2021-10-01 13:16 ` Dmitry Gutov
2021-10-01 17:02 ` bug#50928: [External] : " Drew Adams
2021-10-01 17:31 ` Thierry Volpiatto [this message]
2021-10-03 23:42 ` Tak Kunihiro
2021-10-04 9:29 ` Lars Ingebrigtsen
2021-10-05 3:03 ` Tak Kunihiro
2021-10-05 7:11 ` Lars 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=87fstk648m.fsf@posteo.net \
--to=thievol@posteo.net \
--cc=50928@debbugs.gnu.org \
--cc=dgutov@yandex.ru \
--cc=drew.adams@oracle.com \
--cc=larsi@gnus.org \
--cc=tkk@misasa.okayama-u.ac.jp \
/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.