BUILT-IN WOLFRAM LANGUAGE SYMBOL
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
- Functions like Plus and Times have the attribute OneIdentity.
- The fact that Times has attribute OneIdentity allows a pattern like n_.x_ to match x.
ExamplesExamplesopen allclose all
Basic Examples (1)Basic Examples (1)
The pattern matches, because Times has attribute OneIdentity:
Any function with attribute OneIdentity will match:
| In[3]:= |
Introduced in 1988
(1.0)
| Updated in 2003 (5.0)
© 2016 Wolfram. All rights reserved.