On Feb 23, 1:55 am, pmf <phil.fr...@gmx.de> wrote:
> > (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.

Correction to my drivel: your association is fine, it's just the
  (println "my-var changes =" (change-count-map my-var))
that must be changed to
  (println "my-var changes =" (change-count-map (var my-var))


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to