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 instead of a lazy sequence. Regards, BG On Tue, Jul 31, 2012 at 5:31 PM, Pierre-Henry Perret <[email protected]> wrote: > Evaluating this form: > _________________________________ > (dispatch/react-to #{:dom-loaded} > (fn [t d] (do > (load-todos!) ;; init !todos OK > (log-console (str "todos=" @!todos)) ;; OK > (map #(add-field! (:title %)) @!todos)))) > ;; not evaluated > ___________________________________ > > the last expr is not evaluated : the side effect is on another atom > variable. When this last expr evaluated outside in the repl, it does the job > > Why is that last expr not evaluated in the reactor ? > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to [email protected] > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- Baishampayan Ghose b.ghose at gmail.com -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en
