I'm stumped on this. I have a function that returns a lazy sequence (let's call it lzs - it's produced by another function, and for this exercise I def'd it
in the REPL from `*1'). It's a sequence of maps. When I apply a merge-with operation to the lazy sequence. I get the following error. class clojure.lang.PersistentHashSet cannot be cast to class java.lang.Comparable (clojure.lang.PersistentHashSet is in unnamed module of loader 'app'; java.lang.Comparable is in module java.base of loader 'bootstrap' If I apply the same operation on a `doall' of the sequence, I also get the error. However, if I fully realize the sequence in the REPL and feed it into the merge operation, I don't get the error. There's really no magic in the merge-with operation, it just conj's some sets. Any ideas? The relevant code is below: ;; FAILS (apply merge-with px-tran-netter-ex lzs) ;; FAILS (apply merge-with px-tran-netter-ex (doall lzs)) ;; NO PROBLEM HERE with lzs realized and fed back in (apply merge-with px-tran-netter-ex '({:fund {:src-ax-id #{nil :ax-m01}}} {:fund {:src-ax-id #{:ax-m01}}} {:fund {:src-ax-id nil}} {:fund {:src-ax-id :ax-m01}} {:fund {:src-ax-id #{:ax-m01}}} {:fund {:src-ax-id #{nil :ax-m01}}} {:fund {:src-ax-id #{:ax-m01}}} {:fund {:src-ax-id nil}} {:fund {:src-ax-id :ax-m01}} {:fund {:src-ax-id #{:ax-m01}}})) The px-tran-netter-ex is (defn px-tran-netter-ex [ov nv] (if (nil? ov) nv (update ov :src-ax-id (fn px-tran-set-merger [lv rv] (if (some? rv) (conj (if (set? lv) lv (if (some? lv) #{lv} #{})) rv) lv)) (:src-ax-id nv)))) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/clojure/86ea4d9a-bd32-499c-8626-45068a98808d%40googlegroups.com.