Function Repository Resource:

Arity

Source Notebook

Compute the arity of a function

Contributed by: Peter Cullen Burbery and Eric James Parfitt

ResourceFunction["Arity"][function]

finds the possible arity values of function.

Examples

Basic Examples

Find the arity for DSolve:

In[1]:=
ResourceFunction["Arity"][DSolve]
Out[1]=

Partition:

In[2]:=
ResourceFunction["Arity"][Partition]
Out[2]=

ListConvolve:

In[3]:=
ResourceFunction["Arity"][ListConvolve]
Out[3]=

Use Information to verify the output:

In[4]:=
Information[ListConvolve]
Out[4]=

Test the arity for a user defined function:

In[5]:=
f[p_, q_] := b

f[p_, q_, r_] := c

f[p_, q_, r_, s_, t__] := d
In[6]:=
ResourceFunction["Arity"][f]
Out[6]=

Publisher

Peter Burbery

Version History

  • 1.0.0 – 17 October 2022

Related Resources

License Information