Skip to content

Instantly share code, notes, and snippets.

@vsnguyen
Last active August 29, 2015 14:21
Show Gist options
  • Save vsnguyen/a1a266d9f31a9e678133 to your computer and use it in GitHub Desktop.
Save vsnguyen/a1a266d9f31a9e678133 to your computer and use it in GitHub Desktop.
Clojure: Atom
(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