I figured, but had to ask. I'm looking into adding a feature to Midje to be
able to say:

(defn g [a b c d e f g] nil)

(fact
  (f 1) => 1
  (provided
    (g ...) :never ))

instead of what you currently have to say for the equivalent:

(fact
  (f 1) => 1
  (provided
    (g anything anything anything anything anything anything anything) =>
anything :never ))

Knowing the arity of the function would have helped with the internals.

On Thu, Oct 20, 2011 at 11:42 PM, Alan Malloy <a...@malloys.org> wrote:

> No. The summary is: from Java's point of view every function is
> "willing" to accept any number of args, but many of the
> implementations throw an exception. Vars have an :arglists metadata
> key, but that is not generally present on functions. I agree it would
> be nice if function objects carried a set of "acceptable arities" with
> them, but I haven't thought very hard about it - perhaps the
> performance implication this imposes on every function isn't worth it
> for the small minority of times when you need to ask the question.
>
> On Oct 20, 5:58 pm, Alex Baranosky <alexander.barano...@gmail.com>
> wrote:
> > For some work I'm doing it would be very nice to be able to know the
> number
> > of arguments any given function expects to be called with.  Is there
> anyway
> > to get this information at run-time in Clojure?
> >
> > Thanks.
>
> --
> 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 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