Created
November 3, 2014 03:23
-
-
Save FlatMapIO/169f460db598c1fbbbb0 to your computer and use it in GitHub Desktop.
clojure mutable field type
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
(defprotocol IAttr | |
(-get [this]) | |
(-set! [this v]) | |
(deftype MutT [:volatile-mutable x] | |
IAttr | |
(-get [this] x) | |
(-set! [this v] (set! x v))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment