Created
October 19, 2011 22:18
-
-
Save amalloy/1299853 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(is (= (assoc node2 :id "1") | |
(-> layer-name | |
(write-txn (assoc-node "1" node2) | |
(update-node "1" assoc :baz [1 2 3]) | |
(update-node "1" dissoc :baz)) | |
(get-node "1")))) | |
;; the above is sugar for the below. seem useful? | |
(dotxn layer | |
(-> layer | |
(assoc-node "1" node2) | |
(update-node "1" assoc :baz [1 2 3]) | |
(update-node "1" dissoc :baz))) | |
(is (= (assoc node2 :id "1") (get-node layer-name "1"))) | |
;; implementation: | |
(defmacro write-txn [layer-name & actions] | |
`(let [layer-name# ~layer-name | |
layer# (layer layer-name#)] | |
(retro/dotxn layer# | |
(-> layer# | |
~@actions)) | |
layer-name#)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment