Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Find the distinct heads that occur in an expression and their corresponding arities
ResourceFunction["FindHeadArities"][expr] gives an Association whose keys are the distinct heads in expr and whose values are the arities of those heads. |
Find the arities of various heads in the given expression:
In[1]:= |
Out[1]= |
FindHeadArities lists all the arities found for a head:
In[2]:= |
Out[2]= |
By default, FindHeadArities ignores atomic expressions:
In[3]:= |
Out[3]= |
Use "IncludeAtoms"→True to account for atomic expressions:
In[4]:= |
Out[4]= |
FindHeadArities operates on the evaluated form of expressions:
In[5]:= |
Out[5]= |
In[6]:= |
Out[6]= |
Wrap expressions in Unevaluated to work with unevaluated versions:
In[7]:= |
Out[7]= |
In[8]:= |
Out[8]= |
This work is licensed under a Creative Commons Attribution 4.0 International License