This is documentation for Mathematica 3, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)
 Documentation / Mathematica / Built-in Functions / Programming / Expression Structure  /
Heads

  • Heads is an option for functions which use level specifications that specifies whether heads of expressions should be included.
  • Heads -> True treats heads just like other elements of expressions for the purpose of levels.
  • Heads -> False never includes heads as part of any level of an expression.
  • Most functions which use level specifications have the default setting Heads -> False. One exception is Position, for which the default is Heads -> True.
  • See the Mathematica book: Section 2.1.7.
  • See also: Level.

    Further Examples

    Here is an expression.

    In[1]:=

    Out[1]=

    This searches for a at levels from 2 downwards.

    In[2]:=

    Out[2]=

    This shows where f appears other than in the head of u.

    In[3]:=

    Out[3]=

    This includes occurrences of f in the head of expressions.

    In[4]:=

    Out[4]=