Currently IFn itself doesn't provide a way for you to do this.

Options:
a) example the source / docs
b) Call the IFn and see which arities throw an ArityException
c) If the IFn is in a var you can get arities from the :arglists metadata

c) is probably your best bet if you know you have a var, e.g.

(meta #'+)
=> {:arglists ([] [x] [x y] [x y & more]), :ns #<Namespace clojure.core>, 
:name +, :column 1, :added "1.2", :inline-arities #<core$_GT_1_QMARK_ 
clojure.core$_GT_1_QMARK_@564b8be6>, :doc "Returns the sum of nums. (+) 
returns 0. Does not auto-promote\n  longs, will throw on overflow. See 
also: +'", :line 936, :file "clojure/core.clj", :inline 
#<core$nary_inline$fn__3961 clojure.core$nary_inline$fn__3961@abb88b8>}



On Monday, 14 October 2013 11:40:23 UTC+8, puzzler wrote:
>
> Is there a handy way to discover the valid arities for an arbitrary 
> Clojure function?
>

-- 
-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to