1.2.0 permalink Arrow_down_16x16

add-cell-watcher

clojure.contrib.dataflow

  • (add-cell-watcher cell key fun)
Adds a watcher to a cell to respond to changes of value. The is a
function of 4 values: a key, the cell, its old value, its new
value. This is implemented using Clojure's add-watch to the
underlying ref, and shared its sematics

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/contrib/dataflow.clj:461 top

(defn add-cell-watcher
  "Adds a watcher to a cell to respond to changes of value.  The is a
   function of 4 values: a key, the cell, its old value, its new
   value.  This is implemented using Clojure's add-watch to the
   underlying ref, and shared its sematics"
  [cell key fun]
  (let [val (:value cell)]
    (add-watch val key (fn [key _ old-v new-v]
                         (fun key cell old-v new-v)))))
Vars in clojure.contrib.dataflow/add-cell-watcher: add-watch defn fn key let val
Used in 0 other vars

Comments top

No comments for add-cell-watcher. Log in to add a comment.