Mathematica > Core Language > Defining Variables and Functions > Attributes > OneIdentity >

OneIdentity

OneIdentity
is an attribute that can be assigned to a symbol f to indicate that , , etc. are all equivalent to x for the purpose of pattern matching.
The pattern matches, because Times has attribute OneIdentity:
Any function with attribute OneIdentity will match:
The pattern matches, because Times has attribute OneIdentity:
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
Any function with attribute OneIdentity will match:
In[3]:=
Click for copyable input
In[4]:=
Click for copyable input
Out[4]=
OneIdentity allows defaults to apply to expressions that do not involve Times at all:
For Flat functions, any sequence of arguments will match:
When f is both Flat and OneIdentity, a and are identical for pattern matching:
New in 1 | Last modified in 5
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team
Format:   HTML  |  CDF