Created
August 28, 2014 03:54
-
-
Save LuminousMonkey/746b3519255402c2b2dd 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
;; Dynamic just means I can use the binding function with it, otherwise it will complain. | |
(def ^:dynamic x 11) | |
(defn func1 | |
[] | |
(println x)) | |
(func1) ;; Prints 11 | |
(binding [x 22] | |
(func1)) | |
;; Prints 22 | |
(func1) ;; Prints 11 | |
;; With the binding function, x only takes on the value within the scope of that function. | |
;; By default, there is no mutation possible. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment