Subject: Re: bug#50928: remove-dups

From: Lars Ingebrigtsen <[email-masked]>
Date: Fri, 01 Oct 2021 14:45:39 +0200

Tak Kunihiro <[email-masked]> writes:

> 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

This is basically seq-uniq:

---
seq-uniq is an autoloaded compiled Lisp function in ‘seq.el’.

(seq-uniq SEQUENCE &optional TESTFN)
---

The seq library has a pretty full set of sequence functions, some of
which overlaps with the older functions like `delete-dups'.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no