Cannot say without the rest of the code but I what is in (:transformations
resp)? sorted-set doesn't work if one item doesn't compare to another (eg.
numbers vs maps).
Suppose:
(def a (atom #{}))
=> (var user/a)
(reset! a (into (sorted-set) [1 2 2 2 3]))
=> #{1 2 3}
(conj @a {:name "test"})
ClassCastException clojure.lang.PersistentArrayMap cannot be cast to
java.lang.Comparable clojure.lang.Util.compare (Util.java:153)
Doesn't look like a core.async issue?
HTH,
/thomas
On Wednesday, December 24, 2014 11:19:04 AM UTC+1, Sven Richter wrote:
> Hi,
>
> Using the latest core.async (v0.1.346.0-17112a-alpha) updating a sorted set
> results in an error.
>
> I have this code:
>
> (defn get-transformations []
> (go (let [[ok resp] (<! (h/get-async "/csv/all-transformations"))]
> ;(when ok (reset! sess/transformations-cur (:transformations resp))
> ;works
> (when ok (reset! sess/transformations-cur (into (sorted-set)
> (:transformations resp))) ;does not work
> (println (conj @sess/transformations-cur {:name "test"}))))))
>
> where transformations-cur is a reagent cursor on a reagent atom.
>
> The second reset throws this error (Actually the error occurs on updating the
> cursor (conj @sess/transformations-cur {:name "test"})):
> Uncaught Error: compare on non-nil objects of different types in
> ioc_helpers:41
>
> Are sorted sets not supported?
>
> How do others keep there sets / lists sorted in the UI?
>
> Of course I could sort it every time I display it, but it seems to be more
> correct to keep it sorted inside the state.
>
> Best Regards,
> Sven
--
Note that posts from new members are moderated - please be patient with your
first post.
---
You received this message because you are subscribed to the Google Groups
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.