You might want to look into the various introspection functions, like 
`methods`, `code_lowered`, etc. Leah Hanson had a nice blog post:
http://blog.leahhanson.us/julia-introspects.html

For your specific problem, once you have a specific method, then `m.sig` 
returns 
its signature, and you can just compute the length. A MethodTable (returned by 
`methods(sum)`, for example) is iterable, so you can iterate over the table 
until you find what you want.

Best,
--Tim

On Thursday, October 16, 2014 08:55:01 AM Evan Pu wrote:
> How do I get the number of arguments of a function?
> 
> for instance, f(x, y) = x + y
> 
> I want something like num_args(f), which will give me back 2. If the
> function has multiple methods then something more general would be nice,
> but so far I only care about functions with just a single method.
> 
> Is there something like this?
> thanks alot!!

Reply via email to