Clojure: binding vs. with-redefs
Clojure Vars can have thread-local bindings. binding uses these, while with-redefs actually alters the root binding (which is someting like the default value) of the var. Another difference is that binding only works for :dynamic vars while with-redefs works for all vars. Examples: user=> (def ^:dynamic *a* 1) #’user/*a* user=> (binding [*a* 2] *a*) 2 … Read more