It might be helpful if the documentation at http://clojure.org/namespaces mentioned how to split out a namespace into multiple files.

I never split a namespace into multiple files: I split my project into multiple namespaces.

That way I can simply :require and :use them from each other, and let the dependency system take care of loading.

In your case, I'd have:

;; foo/main.clj
(ns foo.main (:use foo.a foo.util))

(defn main []
  (print "hello from main\n")
  (aaa "FOO-MAIN")
  (util "FOO-MAIN"))

(main)

;; foo/a.clj
(ns foo.a (:use foo.util))

(defn aaa [arg]
  (print (format "hello from aaa: %s\n" arg))
  (util "FOO-A"))

;; foo/util.clj
(ns foo.util)

(defn util [arg]
  (print (format "hello from util: %s\n" arg)))


To make all this directly executable, add (:gen-class) to the main ns, and specify foo.main as the Main-Class in your jar.

--
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

Reply via email to