Re: ClojureScript reactor

2012-07-31 Thread Baishampayan Ghose
Since the REPL tries to print out the lazy sequence it ends up forcing evaluation as well. If you do something like (def foo (some-lazy-seq)) in the repl it won't get forcibly realized as before. This is a very common source of misconception, you're not alone :) Regards, BG On Tue, Jul 31, 2012

Re: ClojureScript reactor

2012-07-31 Thread Pierre-Henry Perret
mapv do the eval. Should be a reflex: when something works in the repl, but not in the code...it's lazy ! Thanks Le mardi 31 juillet 2012 14:07:17 UTC+2, Baishampayan Ghose a écrit : > > Hi, > > map in Clojure (and ClojureScript) is lazy. Since you are not using > the return value of the mapp

Re: ClojureScript reactor

2012-07-31 Thread Baishampayan Ghose
Hi, map in Clojure (and ClojureScript) is lazy. Since you are not using the return value of the mapping, it's not doing much at all. You can force realization of a lazy sequence by putting a (doall... around the map call. You can also use mapv (in Clojure 1.4 at least) which will return a vector

ClojureScript reactor

2012-07-31 Thread Pierre-Henry Perret
Evaluating this form: _ (dispatch/react-to #{:dom-loaded} (fn [t d] (do (load-todos!) ;; init !todos OK (log-console (str "todos=" @!todos)) ;; OK