Created
September 20, 2015 07:21
-
-
Save anonymous/e8e658619f9b92f2bfca 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
(def a [1 2]) | |
(apply conj a [3 4]) | |
;; [1 2 3 4] | |
(def a (atom [1 2])) | |
(swap! a conj [3 4]) | |
;; [1 2 [3 4]] | |
;; According to the docs, swap! Atomically swaps the value of atom to be: | |
;; (apply f current-value-of-atom args). Note that f may be called | |
;; multiple times, and thus should be free of side effects. Returns | |
;; the value that was swapped in. | |
;; So, why does a have a nested vector in it? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment