unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#50928: remove-dups
@ 2021-10-01  3:23 Tak Kunihiro
  2021-10-01 12:45 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 9+ messages in thread
From: Tak Kunihiro @ 2021-10-01  3:23 UTC (permalink / raw)
  To: 50928

I wanted to delete duplicated items from a list non-destructively.
It took me a while to find out how to do so.

(cl-remove-duplicates list :test 'equal)
(delete-dups (copy-sequence list))

I think it is handy to have something like below in subr.el.
Too obvious?

#+begin_src emacs-lisp
(defun remove-dups (list)
  "Remove 'equal' duplicates from LIST non-destructively.
Note that `delete-dups' deletes duplicates destructively."
  (delete-dups (copy-sequence list)))
#+end_src






^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-10-05  7:11 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).