'for' is not recommended for causing side-effects. Since you are not using the return value of the for comprehension, the lazy sequence is not getting realised. You can either use 'doall' around it or better still, use 'doseq'.
Hope that helps. Regards, BG --- Sent from phone. Please excuse brevity. On Jun 16, 2011 9:41 PM, "Thomas" <th.vanderv...@gmail.com> wrote: > Hi All, > > I have a ref with a watcher on it, and I call another function from > the > watch function. I can see that call happens, but the for construct > doesn't > seem to run. Any idea why this is? Am I doing something wrong? > > Here is a simplified version of the code: > > > (def numbers (ref #{1 2 3 4 5 6 7 8 9})) > > (defn more-actions > [col] > (println "this prints" ) > (for [x (range 10)] (println "this doesn't print" col x))) > > (defn watcher > [akey aref old-val new-val] > (println "new value:" new-val) > (more-actions new-val) > ) > > (add-watch numbers "foo" watcher) > > (dosync (alter numbers disj 1)) > > > Thanks in advance, > Thomas > > ps. I am running 1.2.1 > > -- > 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 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