https://clojure.atlassian.net/browse/CLJ-2747 - (distinct) on sets
On the map question, I would be fine returning the MapEntry entries, I don’t mind. I am more worried about the set usage
I would argue that this is not an improvement but a bug
The documentation of (distinct) says that it accepts a collection
Set is a collection:
(coll? #{:foo :bar})
;; => trueI guess the Alternative 2 is a better solution because that should be faster for large sets
I just ran into this today that my function was expecting a collection and when it received a set then it failed
Of course map is also a collection but there I understand that we (distinct) does not accept that
Although with the Alternative 1 that would return a list of MapEntry items
vote here: https://ask.clojure.org/index.php/9010/distinct-should-support-sets
> The documentation of (distinct) says that it accepts a collection
Alternative 3: update the docstring 🙃
> Of course map is also a collection but there I understand that we (distinct) does not accept that
What?! If we are going to stand on principle, let's not exempt maps. After all, what is a set but a degenerate map?!
P.S. have you tried benchmarking distinct rewritten to use first (which is set-compatible) instead of destructuring to nab the first item?