I'm unclear why in the following code snippet, foo is being defined in the "user" namespace, and not the one I've bound to *ns* in the binding closure. Can someone explain what I'm missing?
$ clj Clojure 1.4.0 user=> (let [nspace (create-ns (gensym "sandbox"))] (binding [*ns* nspace] (print (ns-name *ns*)) (def foo 6))) sandbox3#'user/foo user=> foo 6 user=> (in-ns 'sandbox3) # sandbox3=> foo CompilerException java.lang.RuntimeException: Unable to resolve symbol: foo in this context, compiling:(NO_SOURCE_PATH:0) sandbox3=> (def bar 7) #'sandbox3/bar sandbox3=> bar 7 sandbox3/user=> (in-ns 'user) # user=> foo 6 user=> bar CompilerException java.lang.RuntimeException: Unable to resolve symbol: bar in this context, compiling:(NO_SOURCE_PATH:0)