On 23 June 2011 17:04, Antonio Recio <[email protected]> wrote:
> I have found a function to get the methods of the classes in the book The
> Joy of Clojure, and I would like to use it in REPL. Instead of
> "java.awt.Frame" I would like to specify the library that I want writing
> something like (methods any.library). Which is the way to get it?
> (for [method (seq (.getMethods java.awt.Frame)) :let [method-name (.getName
> method)]] method-name)

You can do the above like this:

(map #(.getName %) (.getMethods java.awt.Frame))

And to turn it into a function, you just do this:

(defn class-methods [class-name]
  (map #(.getName %) (.getMethods class-name)))

-- 
Michael Wood <[email protected]>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to