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:

Wolfram Research (1988), Head, Wolfram Language function, https://reference.wolfram.com/language/ref/Head.html (updated 2020).

Text

Wolfram Research (1988), Head, Wolfram Language function, https://reference.wolfram.com/language/ref/Head.html (updated 2020).

BibTeX

@misc{reference.wolfram_2021_head, author="Wolfram Research", title="{Head}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/Head.html}", note=[Accessed: 20-October-2021 ]}

BibLaTeX

@online{reference.wolfram_2021_head, organization={Wolfram Research}, title={Head}, year={2020}, url={https://reference.wolfram.com/language/ref/Head.html}, note=[Accessed: 20-October-2021 ]}

CMS

Wolfram Language. 1988. "Head." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/Head.html.

APA

Wolfram Language. (1988). Head. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Head.html