bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#50928: remove-dups


From: Dmitry Gutov
Subject: bug#50928: remove-dups
Date: Fri, 1 Oct 2021 16:16:33 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0

On 01.10.2021 15:45, Lars Ingebrigtsen wrote:
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'.

seq-uniq is O(N^2), though, so it's going to be less efficient than

  (delete-dups (copy-sequence list))

I think the idea was to add specialized faster implementations for different data types, but that hasn't happened, so far.

And its signature (accepting testfn) might make the obvious optimization which delete-dups uses (caching the "known" set in a hash table) not feasible. Maybe we could use a hash table for a limited set of testfn's.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]