> (defn my-watcher-action [current-value reference] > (let [change-count-map current-value > old-count (change-count-map reference) > new-count (if old-count (inc old-count) 1)] > (assoc change-count-map reference new-count)))
It seems to me that your problem is that you are not associating the change-count-map with the var, but with the var's value. I.e. changing the var causes the watcher-action to fire and adds a new key for the new value of var instead of updating the existing key (which is the var's former value). Try printing the full @my-watcher to see what I mean. For agent and refs this problem does not manifest itself because they are not dereferenced automatically in my-watcher-action. --~--~---------~--~----~------------~-------~--~----~ 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 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 -~----------~----~----~----~------~----~------~--~---