fix mutable cell for clj
This commit is contained in:
parent
f3080d8e09
commit
6b0a907fff
1 changed files with 4 additions and 1 deletions
|
|
@ -315,10 +315,12 @@
|
||||||
|
|
||||||
;; cell implementation idea taken from prismatic schema library
|
;; cell implementation idea taken from prismatic schema library
|
||||||
(defprotocol PMutableCell
|
(defprotocol PMutableCell
|
||||||
|
#?(:clj (get_cell [cell]))
|
||||||
(set_cell [cell x]))
|
(set_cell [cell x]))
|
||||||
|
|
||||||
(deftype MutableCell [^:volatile-mutable q]
|
(deftype MutableCell [^:volatile-mutable q]
|
||||||
PMutableCell
|
PMutableCell
|
||||||
|
#?(:clj (get_cell [cell] q))
|
||||||
(set_cell [this x] (set! q x)))
|
(set_cell [this x] (set! q x)))
|
||||||
|
|
||||||
(defn mutable-cell
|
(defn mutable-cell
|
||||||
|
|
@ -329,7 +331,8 @@
|
||||||
(set_cell cell val))
|
(set_cell cell val))
|
||||||
|
|
||||||
(defn get-cell [cell]
|
(defn get-cell [cell]
|
||||||
(field cell 'q))
|
#?(:clj (get_cell cell) :cljs (field cell 'q))
|
||||||
|
)
|
||||||
|
|
||||||
(defn update-cell! [cell afn]
|
(defn update-cell! [cell afn]
|
||||||
(let [ret (afn (get-cell cell))]
|
(let [ret (afn (get-cell cell))]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue