On 6 February 2010 00:52, Mike Jarmy <mja...@gmail.com> wrote: > OK, here's a slightly more elaborate toy example that works. In this > example, foo-main.clj needs foo-a.clj, and they both need > foo-util.clj. I was expecting the (in-ns) call in foo-a to have a > ":load" keyword, just like (ns) in foo-main, but it doesn't, so I just > called (load) afterwards. > > Anyway, this will work for me. If there is a more idiomatic way to do > it, let me know.
Well this works for me. Note the lack of (load "util") in foo-a.clj. Note also that "foo-util" is loaded before "foo-a" in the ns form: ; Directory structure: ; example/ ; example/foo-util.clj ; example/foo-a.clj ; example/foo.clj ; example/foo.clj (ns example.foo (:load "foo-util" "foo-a")) (defn main [] (println "hello from main") (aaa "FOO-MAIN") (util "FOO-MAIN")) (main) ; example/foo-a.clj (in-ns 'example.foo) (defn aaa [arg] (printf "hello from aaa: %s\n" arg) (util "FOO-A")) ; example/foo-util.clj (in-ns 'example.foo) (defn util [arg] (printf "hello from util: %s\n" arg)) $ java -cp /path/to/clojure.jar:. clojure.main example/foo.clj hello from main hello from aaa: FOO-MAIN hello from util: FOO-A hello from util: FOO-MAIN See also e.g. clojure.contrib.pprint which does something like the above. Whether or not this is the best way to split things up, I don't know. -- Michael Wood <esiot...@gmail.com> -- 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 Note that posts from new members are moderated - please be patient with your first post. 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