hi,

i'm guessing there is a more Clojure-y and compact way to do this. any
suggestions would be appreciated. thank you.

(defn reflection-dump [o]
  (let [methods (.getDeclaredMethods o)
        method-count (alength methods)
        method-dumps (map (fn [i] (str " " i ": " (nth methods i))) (range 0
method-count))
        method-dump-str (apply str (interpose "\n" method-dumps))
        header-str (str o " has " method-count
                        (cond
                         (= method-count 0) " methods."
                         (= method-count 1) " method:"
                         true " methods:"))
        full-str (if (> method-count 0)
                   (concat header-str "\n" method-dump-str)
                   header-str)]
    (apply str full-str)))
-- 
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