Last active
August 29, 2015 14:01
-
-
Save pbostrom/3dec3394add6b3500e47 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
;; 1. top-level let | |
(let [state (atom 0)] | |
(defn do-stuff1 [] | |
(swap! state inc)) | |
(defn do-stuff2 [] | |
(swap! state dec))) | |
;; 2. top-level atom | |
(def state (atom 0)) | |
(defn do-stuff1 [] | |
(swap! state inc)) | |
(defn do-stuff2 [] | |
(swap! state dec)) | |
;; 3. atom arg | |
(defn do-stuff1 [state] | |
(swap! state inc)) | |
(defn do-stuff2 [state] | |
(swap! state dec)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment