On Sep 23, 10:47 am, Stuart Sierra <[EMAIL PROTECTED]>
wrote:
> On Sep 23, 9:50 am, Rich Hickey <[EMAIL PROTECTED]> wrote:
>
> > I've added some support for agent watches. You should consider it
> > experimental, but it will allow the creation of cell-like and other
> > reactive systems.
>
> Cool, thanks Rich! This will be fun to play with. One question -- is
> it possible to get the previous value of the agent (before the action)
> from within the callback fn?
>
> I noticed this -- if a callback throws an exception, the agent stops
> accepting messages, but agent-errors remains empty:
>
> user=> (def a1 (agent 1))
> user=> @a1
> 1
> user=> (add-watch a1 :dumb (fn [w a c] (eval 'missing-var)))
> user=> (send a1 (fn [a] 2))
> user=> @a1
> 2
> user=> (send a1 (fn [a] 3))
> user=> @a1
> 2 ;; The last action didn't run
> user=> (agent-errors a1)
> nil
>
> -Stuart
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---