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=> (app/reader "data") hello 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. I found that I could get the behavior I wanted if I changed the definition of reader to: (defn reader [filename] (binding [*ns* (the-ns 'app)] (load-file filename))) But this has a sort of evil feeling to it. Is there a better way of doing this? Thanks, Paul P.S. I know that doing (load-file "app.clj") (in-ns 'app) (reader "data") from the REPL works as well, but I don't want to force the user to switch namespaces. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---