You might change the method-dumps definition to this:

method-dumps (map (fn [i x] (str " " i ": " x)) (range 0 method-count)
methods)

It isn't more compact but I suppose it's more Clojure-y.

On Jan 14, 6:49 pm, Raoul Duke <rao...@gmail.com> wrote:
> 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