I required namespace and I can use it:
(ns core (:require [hello :as h])) (println h/x)
But why I can't print namespace only?
(println h) # Unable to resolve symbol: h in this context
I tried this with deps-tools and leiningen
When you say
(println h) you are asking to print the value bound to the symbol
h in the current namespace.
h is not interpreted as a namespace (or namespace alias) unless it is followed by a
/ character. So
(println h/x) asks to print the value bound to the symbol
x in the namespace referenced by the alias
h, in other words,
hello.x. You have not bound anything to the symbol
h in your namespace, so
h on its own is undefined.
If you want to look at the namespace itself, do something like
(println (the-ns 'hello)) (see https://clojuredocs.org/clojure.core/the-ns).