Are you sure the code below works? It doesn't work for me with the revision 1185. For me it outputs:
#<Agent clojure.lang.ag...@355a47> 0 and stops. On Tue, Dec 23, 2008 at 12:18 PM, Stephen C. Gilardi <squee...@mac.com> wrote: > > 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-agent > user=> (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 -- R. Mark Volkmann Object Computing, Inc. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---