This solved the problem:

(defn ask-material [a-key the-ref old-state new-state]
        (if (<= new-state 0)
                (dosync (alter material + (int (rand 10)))))
        (str "asked for materials"))


When the function ask-materials is invoked, it updates the state of
the agent that caused the change. (in this case artisan) Well that's
what I thought until I read your reply, now I'm clueless.


Is there some way to "dump" the state of all refs, atom, agents etc
when they are updated? I was thinking of adding watchers to everything
but that's incredibly messy. I just want to debug and also to see
what's going on, possible to feed the updates to a 3d environment.

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

Reply via email to