I want to understand OneIdentity.
I will clear f so I have so values associated with it.
In[]:=
f//ClearAll
In[]:=
Attributes[f]
Out[]=
{}
In[]:=
SetAttributes[f,OneIdentity]
In[]:=
Attributes[f]
Out[]=
{OneIdentity}
The documentation states this
f
f[x]
f[f[x]]
x
For some reason this returns False:
In[]:=
MatchQ[x,f[x]]
Out[]=
False
In[]:=
MatchQ[x,f[f[x]]]
Out[]=
False
In[]:=
AllTrue[MatchQ[x]][NestList[f,x,10]]
Out[]=
False
Why doesn’t this return True?