On Feb 9, 5:00 pm, Stuart Sierra <the.stuart.sie...@gmail.com> wrote:
>
> My latest implementation, at clojure.contrib.auto-agents, does *not*
> handle circular dependencies.  It uses Agents and Watchers to
> implement the updates.

from auto-agent.clj:


(defmacro auto-agent
  "Creates an agent whose value is the result of evaluating expr.
  Whenever one of the agents/atoms/refs dererenced within expr
  changes, expr is reevaluated and this agent's state is set to its
  new value."
  [expr]
  `(let [value-fn# (fn [old# a#] ~expr)
         cell# (agent (value-fn# nil nil))]
     (doseq [d# (find-derefs ~expr)]
       (add-watcher d# :send cell# value-fn#))
    ^^^^^^^^^^^^^
     cell#))


this errors on loading. Should that be "add-watch" instead?


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