OneIdentity

OneIdentity
is an attribute that can be assigned to a symbol f to indicate that f[x], f[f[x]], etc. are all equivalent to x for the purpose of pattern matching.

DetailsDetails

ExamplesExamplesopen allclose all

Basic Examples  (1)Basic Examples  (1)

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]=
Introduced in 1988
(1.0)
| Updated in 2003
(5.0)
Translate this page: