This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-06-23
Channels
- # announcements (11)
- # babashka (35)
- # beginners (110)
- # calva (2)
- # cider (46)
- # clara (5)
- # clj-kondo (29)
- # cljdoc (4)
- # cljsrn (59)
- # clojure (163)
- # clojure-brasil (3)
- # clojure-europe (24)
- # clojure-italy (2)
- # clojure-nl (10)
- # clojure-sweden (1)
- # clojure-uk (36)
- # clojurescript (58)
- # conjure (24)
- # cursive (19)
- # data-science (14)
- # datascript (1)
- # datomic (10)
- # docker (3)
- # expound (6)
- # figwheel-main (17)
- # fulcro (16)
- # graalvm (1)
- # leiningen (9)
- # malli (11)
- # off-topic (22)
- # parinfer (1)
- # pathom (1)
- # re-frame (18)
- # reagent (18)
- # reitit (3)
- # ring (3)
- # shadow-cljs (8)
- # spacemacs (3)
- # specter (79)
- # sql (20)
- # tools-deps (25)
- # vim (4)
- # xtdb (8)
I discovered two unexpected things today:
• open-q
returns duplicates
• q
applies :limit
before removing duplicates (makes sense given the first point)
It's not a huge deal now that I know about it, at least since I'm not actually using :limit
in my application (I've only been using it during repl exploration). But would it be difficult/harmful to performance if duplicates were automatically removed from open-q
's results + if :limit
was applied after removing duplicates? That would be much less surprising IMO. Otherwise, I'd suggest mentioning those things in the docs.
Morning 🙂 I think this is for historical reasons - I'll check the context and get back to you
Maybe, but it wasn't obvious to me that's what would happen, despite knowing it didn't return a set. Before I was aware of the behaviour, I assumed that iterating over the return values of q
and open-q
would yield the same results (with different performance characteristics obviously), which I think is a reasonable assumption.
It does make since that open-q
would include duplicates since I'm not aware of how you'd remove duplicates without retaining the result set in memory, defeating the purpose of streaming the results (right?). A note in the docs would still be helpful though.
I'm not sure if dedupe
uses hashes or values to dedupe with. But it could potentially be done.
distinct
would be the relevant function. It uses values.