Last active
August 29, 2015 14:21
-
-
Save vsnguyen/a1a266d9f31a9e678133 to your computer and use it in GitHub Desktop.
Clojure: Atom
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
(def my-atom (atom nil)) | |
;; @my-atom | |
;; nil | |
(defn update-my-atom [value] (reset! my-atom value)) | |
@my-atom | |
;; nil | |
(update-my-atom 10) | |
;; 10 | |
@my-atom | |
;; 10 | |
(update-my-atom 11) | |
;; 11 | |
@my-atom | |
;; 11 | |
(update-my-atom 12) | |
;; 12 | |
@my-atom | |
;; 12 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment