[ClojureScript] Re: Updating sorted set inside go block

2014-12-25 Thread Thomas Heller
Hey, I figured it out. Fun puzzle. ;) As expected core.async is not the real villain here, the behavior sure is odd but I'm not sure it is a bug. The issue is that {:name test} inside a go block always gets turned into a hash-map, while outside the better option array-map is chosen by the

Re: [ClojureScript] Re: Updating sorted set inside go block

2014-12-25 Thread David Nolen
I would actually consider this a core.async defect - the interpretation of literals should not be different in go blocks. I would open a core.async issue with all the details of this thread summarized. David On Thu, Dec 25, 2014 at 12:14 PM, Sven Richter sver...@googlemail.com wrote: Hi Thomas,

[ClojureScript] Re: Updating sorted set inside go block

2014-12-25 Thread Thomas Heller
I'd imagine it becomes even less obvious once you start using your app and at some point assoc into an array-map, getting over the threshold and turning the result into a hash-map. I'd imagine that would be really hard to track down. Anyways, sorted-set seems to have all sorts of caveats. So

[ClojureScript] Re: Updating sorted set inside go block

2014-12-25 Thread Sven Richter
Hi, while I was preparing the bug report Captaion Obvious hit me again. This also occurs in clojure: As Thomas said, this is enough to reproduce it: (def a (atom #{})) (reset! a (into (sorted-set) [{:name foo}])) (swap! a conj {:name bar}) - java.lang.ClassCastException:

Re: [ClojureScript] Re: Updating sorted set inside go block

2014-12-25 Thread David Nolen
Seems like a separate issue to me. David On Thu, Dec 25, 2014 at 3:25 PM, Sven Richter sver...@googlemail.com wrote: Hi, while I was preparing the bug report Captaion Obvious hit me again. This also occurs in clojure: As Thomas said, this is enough to reproduce it: (def a (atom #{}))

Re: [ClojureScript] Re: Updating sorted set inside go block

2014-12-25 Thread Tom Jack
Maps aren't comparable, so they don't make sense with sorted-set. This is not a bug. On Dec 25, 2014 12:25 PM, Sven Richter sver...@googlemail.com wrote: Hi, while I was preparing the bug report Captaion Obvious hit me again. This also occurs in clojure: As Thomas said, this is enough to

[ClojureScript] Re: Updating sorted set inside go block

2014-12-24 Thread Thomas Heller
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})

[ClojureScript] Re: Updating sorted set inside go block

2014-12-24 Thread Sven Richter
Hi Thomas, the code I pasted was maybe a bit misleading. Function one: (defn save-transformation [_] (go (let [trans-name (hel/get-value transformation-name) [ok _] (! (hel/post-async-ch /cvs/save-transformation {:name trans-name

[ClojureScript] Re: Updating sorted set inside go block

2014-12-24 Thread Thomas Heller
That code doesn't help much either since there is still no way to tell what sess/transformations-cur is. I'd suggest printing the value before trying to swap! it, I see no reason anything in there would confuse core.async. (defn save-transformation [_] (go (let [trans-name (hel/get-value

[ClojureScript] Re: Updating sorted set inside go block

2014-12-24 Thread Sven Richter
Hi Thomas, Thanks for taking the time to answer me. Ok, this is the session namespace, reduced to the relevant parts: (ns de.sveri.structconverter.session (:require [reagent.cursor :refer [cur]] [reagent.core :refer [atom]])) (def state (atom {:cur-csv-page nil :files []