cljs.core.async: Uncaught ReferenceError: state_machine__5113__auto____$1 is not defined
I'm trying to use cljs.core.async to convert async code to synchronous, I've hit a problem chaining some calls. I'm getting a runtime state machine problem, here is a test case for the issue: (defn td [id t] (let [c (chan)] (window/setTimeout (fn [] (go (! c (name id t) c )) (defn tdw [id t] (go (let [id2 (! (td id 500)) c (chan)] (window/setTimeout (fn [] (go (! c id2))) t) (! c) ))) (defn start [] (let [p (fn [v] (.debug js/console (str v: v)))] (go (p (! (td :1 1000))) (p (! (td :2 1))) (p (! (tdw :3 200))) ))) The output is : v: 1 v: 2 1. Uncaught ReferenceError: state_machine__5113__auto$1 is not defined tdw fails in its setTimeout callback. Is this a legal use case? Have I made a fundamental mistake? -- -- 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. For more options, visit https://groups.google.com/groups/opt_out.
Re: cljs.core.async: Uncaught ReferenceError: state_machine__5113__auto____$1 is not defined
Thanks Tassilo, As you point out, if I move the nested function outside the go then the problem is fixed. This test case is only a simplification of the original code so I can't do this in my actual code however after much head scratching I now understand the purpose of take! and it addresses my issue: test case solution: (defn tdw2 [id t] (let [id2 (go (! (td id 500))) c (chan)] (window/setTimeout (fn [] (go (! c (! id2 t) c )) Required solution: (defn tdw [id t] (let [c (chan)] (take! (td id 500) (fn [id2] (window/setTimeout (fn [] (go (! c id2))) t))) c )) -- -- 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. For more options, visit https://groups.google.com/groups/opt_out.
ClojureScript js-clj not converting
I've updated to 0.0-1586 build #22 from a much older release: 0.0-1450 I'm now geting a problem with (js-clj token) not converting the object I don't think the problem is with js-clj: (println (expose token true)) gives: access_token = ya29.AHES6ZSgnk3Ws5bB-2aDx41Bbr335hKugjZJfcNAs83d121S306fxy64 token_type = Bearer expires_in = 3600 client_id = 52351124085.apps.googleusercontent.com scope = https://www.googleapis.com/auth/drive.file,https://www.googleapis.com/auth/drive.metadata.readonly,https://www.googleapis.com/auth/drive.readonly g_user_cookie_policy = undefined cookie_policy = undefined issued_at = 1361807171 expires_at = 1361810771 This looks ok. however token gives: Error evaluating: token :as esef.client.evidence.token #TypeError: Object [object Object] has no method 'toString' TypeError: Object [object Object] has no method 'toString' (type token) gives a blank line. I think this is why js-clj isn't converting. (alength token) gives a blank line. (.-token_type token) Correctly gives ya29.AHES6ZSgnk3Ws5bB-2aDx41Bbr335hKugjZJfcNAs83d121S306fxy64 Any ideas? Thanks Mike. -- -- 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. For more options, visit https://groups.google.com/groups/opt_out.