On Tue, Nov 16, 2010 at 4:06 AM, Christophe Grand <christo...@cgrand.net>wrote:

> You can implement your own, prettu easily with deftype.
> However it can be tedious to track every methods, so we need a repl helper
> function to scaffold the code for us.
>
> (defn scaffold [iface]
>   (doseq [[iface methods] (->> iface .getMethods
>                             (map #(vector (.getName (.getDeclaringClass %))
>
>                                     (symbol (.getName %))
>                                     (count (.getParameterTypes %))))
>                             (group-by first))]
>     (println (str "  " iface))
>     (doseq [[_ name argcount] methods]
>       (println
>         (str "    "
>           (list name (into ['this] (take argcount (repeatedly
> gensym)))))))))
>

Neat! Seems like something that could be useful in clojure.repl :)

David

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