newbie: namespaces and load-file

2009-01-22 Thread Paul Henning
Suppose I have a clojure file called app.clj that contains something like: (ns app) (defn foo [] (println hello)) (defn reader [filename] (load-file filename)) and a file called data that simply contains (foo) What I would like to see, from the REPL, is: user= (load-file app.clj) user=

Re: newbie: namespaces and load-file

2009-01-22 Thread Stephen C. Gilardi
On Jan 22, 2009, at 12:46 PM, Paul Henning wrote: As described, this doesn't work. load-file looks up symbols in the current namespace (user in this case), but foo is interned in app. At some point in this process, Clojure needs to know which foo you're talking about. It can't retrieve

Re: newbie: namespaces and load-file

2009-01-22 Thread Paul Henning
At some point in this process, Clojure needs to know which foo you're   talking about. It can't retrieve the var associated with foo without   knowing which namespace it's in. That determination can either be   explicit or it can be made via the current namespace (*ns*), but it   has to be

Re: newbie: namespaces and load-file

2009-01-22 Thread Stephen C. Gilardi
On Jan 22, 2009, at 3:56 PM, Paul Henning wrote: As long as no one cares if I muck with *ns*, I can make it work [...] That brings up an important point. The var *ns* may look like a global variable in C++, but it's really a dynamic variable--something quite a bit safer and more