vishy wrote:
> How can I find out all the namespaces in a library like
> clojure.contrib.

I assume you mean doing this at the REPL or OS shell.  I don't know how 
to do it for non-loaded libs, aside from manually walking the classpath, 
but (all-ns) might be what you want for loaded namespaces.

Usually I just look at the documentation or the source code of the 
library (eg. unzip -l clojure-contrib.jar | grep 'clj$').

> Also, how to find all the functions defined in a
> namespace?

There's some useful functions in clojure.contrib.ns-utils for printing 
documentation, for example:

   (use 'clojure.contrib.ns-utils)
   (docs clojure.xml)

If you literally just wanted a list of all the functions in a namespace. 
then (ns-publics 'some.namespace) will give you a map of all the vars in 
the namespace.  You could then just filter the ones that are functions. 
  So something like:

   (defn ns-functions [ns]
     (for [[n, v] (ns-publics ns)
           :when (and (.isBound v)
                      (instance? clojure.lang.Fn @v))]
       n))

   (ns-functions 'clojure.xml)

=> (startparse-sax parse emit-element emit)

Cheers,

Alex

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