On Mon, Jan 17, 2011 at 10:47 PM, Seth <wbu...@gmail.com> wrote: > if you 'use' ns A in ns B, ns C which uses B will not see the > functions of A. Im trying to create a ns which collects functions from > various other ns and exports them so that all you have to do is use > that one uber ns.
And, Clojure being a language with good meta facilities, you figured it ought to be as easy as (ns uber-ns :use (other-ns yet-another-ns)) (foo other-ns) (foo yet-another-ns) for some choice of "foo". I'd figure something like this might work: (defn make-def [name value] `(def name value)) (defmacro foo [target-ns] `(do ~@(map #(make-def % (symbol (str target-ns "/" %))) (get-all-public-symbols target-ns)))) given an implementation of "get-all-public-symbols" that, given a namespace *symbol* and *at macroexpansion time*, produces a seq of the symbols of public vars in that namespace; so if called on the symbol 'clojure.core it would produce something like ('condp 'for 'map 'doall 'println 'seq ...) and foo would produce something like (do (def condp clojure.core/condp) (def for clojure.core/for) ...). Making foo copy the metadata of the var as well as the value is left as an exercise for the reader. As is implementing get-all-public-symbols. -- 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