Hi Jeffrey,

Neman Cells can handle circular dependencies, its just for now I
didn't need such a feature so its not exposed in clear way how to do
it:

  (def a (Cell. {:value 5}))
  (def b (cell [a] [v] (dec v)))
  (add-trigger a
    (fn [old-v new-v]
      (println (str "Cell a changed from: " old-v " to " new-v))))
  (add-trigger b
    (fn [old-v new-v]
      (println (str "Cell b changed from: " old-v " to " new-v))))
  (alter-cell a [b] [v] (if (< v 0) 0 v))

Also, there is nothing like cell-set!, I use them for now only as read-
only values, but if you wish you can set cell's value with:
(assoc (.state cell) :value new-value)

If you need something more deterministic, you could change update-cell
function in first implementation by Stuart so it updates all
dependencies in one dosync block.

--
Krešimir Šojat
--~--~---------~--~----~------------~-------~--~----~
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