📝Clojure: dynamic scoping
- tags
(def ^:dynamic name "world")
;; or
;; (declare ^:dynamic name)
(defn hello []
(printf "Hello, %s!\n" name))
(binding [name "blah"]
(hello))
(hello)
Hello, blah! Hello, world!
(def ^:dynamic name "world")
;; or
;; (declare ^:dynamic name)
(defn hello []
(printf "Hello, %s!\n" name))
(binding [name "blah"]
(hello))
(hello)
Hello, blah! Hello, world!