I randomly found that Depth
has a boolean option called Heads
:
In[1]:= Depth[1, 2, 3, 4]
During evaluation of In[7]:= Depth::nonopt: Options expected (instead of 4) beyond position 1 in Depth[1,2,3,4]. An option must be a rule or a list of rules. >>
Out[1]= Depth[1, 2, 3, 4]
In[2]:= Options[Depth]
Out[2]= {Heads -> False}
This is not documented but seems to do what one would guess. For example, the reference explicitly says as a "possible issue" that
Depth
does not count depth in the head:In[1]:= Depth[h[{{{a}}}][x, y]] Out[1]= 2
but adding Heads -> True
does exactly that:
In[2]:= Depth[h[{{{a}}}][x, y], Heads -> True]
Out[2]= 6
I wonder why the reference would go as far as saying that something that exists does not. Is this possibly a feature that used to be supported but (for whatever reason) is only kept for historical reasons, like the examples here? Can anyone confirm if the option is documented in some prior version?
AllowHeads
ofDimensions
. Should I report when I stumble upon similar cases? $\endgroup$