I'm trying to load and/or compile a .clj file from within another .clj file.
I'm doing this because the file I'm trying to load just contains a bunch of maps, and I intend eventually to replace these with an xml file. I could just :use
the file and it'll work, but I'm trying to go through the exercise of loading an external bunch of data.
Through some random hacking around the repl (via emacs etc) I was able to (load "default_libs")
as well as (compile...)
it somehow (using different combinations of namespace qualifiers, '
, and "
) and get access to the maps, but after restarting the repl it didn't work any more, and anyway I had to use the full namespace name to get to the data.
This is lib_manager.clj:
(ns mycad.lib-manager
(:use [clojure repl]
[mycad utils]))
(compile 'mycad.default-libs)
(println mycad.default-libs/default-symbols)
This is the file I'm trying to load, default_libs.clj
. The data here will eventually be some xml file, but I'm still pretty new at this, so for now I've just written a bunch of clojure maps directly.
(ns mycad.default-libs)
(def default-symbols {.... })
So the question is how can I load a bunch of data from a .clj
file without really loading it into the namespace with (ns...)
but instead treating it as a source of data using either load
or compile
?
Thanks for any help