Created
May 1, 2013 17:54
-
-
Save Melipone/5496925 to your computer and use it in GitHub Desktop.
Dynamic variables
This file contains hidden or 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
(declare ^:dynamic myvar) | |
(def myvar nil) | |
(defn mycounter [x] | |
(inc x)) | |
(defn testdynvar [x] | |
(myvar x)) | |
(defn myfn [x] | |
(binding [myvar (memoize mycounter)] | |
(testdynvar x))) | |
;;(load-file "testdynamic.clj" | |
;;(myfn 3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment