【发布时间】:2015-04-15 21:42:46
【问题描述】:
这是来自Clojure Programming的代码示例
(def history (atom ()))
(defn log->list
[dest-atom key source old new]
(when (not= old new)
(swap! dest-atom conj new)))
(def sarah (atom {:name "Sarah" :age 25}))
(add-watch sarah :record (partial log->list history))
(swap! sarah update-in [:age] inc)
(swap! sarah identity)
(pprint @history)
log->list 函数有两个永远不会被使用的参数 key 和 source。他们来这里做什么?
【问题讨论】:
标签: concurrency clojure