Head

Head[expr]

gives the head of expr.

Head[expr,h]

wraps the result with h.

Examples

open allclose all

Basic Examples  (3)

The head of a function:

The head of a list:

The heads of atomic expressions:

Scope  (3)

The head of a function entered with an operator:

The head of a compound expression:

Wrap the result in Hold to prevent the result from evaluating:

Without the second argument, the InverseFunction expression would evaluate:

Applications  (2)

Find the cases with a head of Integer:

Verify the result:

Define a function that extracts the head and guarantees no evaluation occurs:

Without the HoldComplete, a Function object would be returned:

Properties & Relations  (2)

The head is the part with index 0:

Head[e,f] is effectively equivalent to Extract[e,0,f]:

Possible Issues  (1)

The head is based on FullForm:

Neat Examples  (1)

Head always eventually burrows to a symbol:

Introduced in 1988
 (1.0)
 |
Updated in 2020
 (12.1)