On Dec 23, 2008, at 1:03 PM, CuppoJava wrote:
(send-off my_agent #( ... )) But I need the agent's state to be updated within send-off. How do I go about doing that?
The new value for the agent will be the return value from the update function.
Something like: user=> (def my-agent (agent 0)) #'user/my-agentuser=> (defn update [old-state] (prn old-state) (.sleep Thread 1000) (send-off *agent* update) (inc old-state))
#'user/update user=> (send-off my-agent update) 0 #<Agent clojure.lang.ag...@79866b99> user=> 1 2 3 4 5 --Steve
smime.p7s
Description: S/MIME cryptographic signature