;; This example will illustrate changing between namespaces at the repl
;; At the repl, the ns macro can be used to create a namespace, and also be used to change the current namespace (be careful of typos)
user=>(ns demo.namespace)
nil
demo.namespace=> ; The prompt at the repl is now "demo.namespace" reflecting that the current namespace is no longer "user".
;; Add a new function to demo.namespace
demo.namespace=>(defn foo [] (prn "Hello from demo.namespace"))
#'demo.namespace/foo
;; From within "demo.namespace" we can use foo without qualifying it
demo.namespace=>(foo)
"Hello from demo.namespace"
;; Switch back to the "user" namespace
demo.namespace=>(ns user)
nil
;; We can no longer use "foo" without qualification
user=> (foo)
java.lang.Exception: Unable to resolve symbol: foo in this context (NO_SOURCE_FILE:4)
user=> (demo.namespace/foo)
"Hello from demo.namespace"
nil
;; If we were back in the "user" namespace though,
;; This example will illustrate changing between namespaces at the repl
;; At the repl, the ns macro can be used to create a namespace, and also be used to change the current namespace (be careful of typos)
user=>(ns demo.namespace)
nil
demo.namespace=> ; The prompt at the repl is now "demo.namespace" reflecting that the current namespace is no longer "user".
;; Add a new function to demo.namespace
demo.namespace=>(defn foo [] (prn "Hello from demo.namespace"))
#'demo.namespace/foo
;; From within "demo.namespace" we can use foo without qualifying it
demo.namespace=>(foo)
"Hello from demo.namespace"
;; Switch back to the "user" namespace
demo.namespace=>(ns user)
nil
;; We can no longer use "foo" without qualification
user=> (foo)
java.lang.Exception: Unable to resolve symbol: foo in this context (NO_SOURCE_FILE:4)
user=> (demo.namespace/foo)
"Hello from demo.namespace"
nil
;; If we were back in the "user" namespace though,