6
$\begingroup$

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?

$\endgroup$
2
  • 7
    $\begingroup$ It is a documentation bug -- this option did not exist originally but was implemented in version 8.0.0. Unfortunately, the documentation update hasn't happened yet. $\endgroup$
    – ilian
    Commented Jan 12, 2018 at 22:21
  • $\begingroup$ Thank you, @ilian. I assume it's the same case for option AllowHeads of Dimensions. Should I report when I stumble upon similar cases? $\endgroup$
    – The Vee
    Commented Jan 21, 2018 at 23:14

1 Answer 1

4
$\begingroup$

As per ilian's comment:

It is a documentation bug -- this option did not exist originally but was implemented in version 8.0.0. Unfortunately, the documentation update hasn't happened yet.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.