Noob question, using Win7 64-bit, Clojure 1.2.0, Java 1.6.0_22
When I start clojure from command line, pprint function is easily available.
user=> pprint
#<pprint$pprint clojure.pprint$pprint@16dfa45>
user=> (pprint "hi")
"hi"
nil
user=>
But when I try to use pprint from a file, I get an error. This happens with and without namespace (ns... :require...) as shown in pprint documentation
clj file as follows:
(ns whatevah
(:require clojure.pprint))
(pprint "hi")
Error as follows:
C:\Users\mischw\code\Clojure>java -cp ";c:\users\mischw\code\clojure\classes\*;c:\Program Files (x86)\Java\SWT;c:\users\mischw\code\clojure\classes\bookcode\*" clojure.main swinglearn.clj
Exception in thread "main" java.lang.Exception: Unable to resolve symbol: pprint in this context (swinglearn.clj:14)
... 21 more
Output completed (0 sec consumed) - Normal Termination
I don't understand the general idea of what's going on here. Why does one work but not the other? Does that have to do with namespaces? Classpaths? Some other simple fix? Clearly noob questions, but I find this happens with a bunch of examples... I'm unable to run them even though it seems straightforward to import/use/require/include them.
use
clojure.pprint? How do I find out what namespaces the repl has loaded, so the next time I get this problem I can figure it out? – Wieldy