HoldAllComplete

Consider the following expression wrapped in Hold.  Hold has the HoldAll attribute, but we can still force evaluation of arguments and sequences are automatically spliced together.  However, nested layers of Plus aren't flattened, and the arguments of Plus aren't sorted.

f[x_] := x^2 ; Hold[Evaluate[2 + 3^2], Sequence[v, w], Sequence[x, y], Plus[d, s, Plus[z, a, Plus[u, u]]], f[5]]

Hold[11, v, w, x, y, d + s + (z + a + (u + u)), f[5]]

In the next cell we use HoldAllComplete.  In this case Evaluate is ignored and sequences are not spliced together.

HoldComplete[Evaluate[2 + 3^2], Sequence[v, w], Sequence[x, y], Plus[d, s, Plus[z, a, Plus[u, u]]], f[5] ]

HoldComplete[Evaluate[2 + 3^2], Sequence[v, w], Sequence[x, y], d + s + (z + a + (u + u)), f[5]]

Built-in Symbols with the HoldAllComplete attribute

The next cell makes a list of all built-in symbols.

symbs = Cases[ToExpression/@Names["System`*"], _Symbol] ;

Very few buit-in symbols have the HoldAllComplete attribute and they are all listed below.

Select[symbs, MemberQ[Attributes[#], HoldAllComplete] &]

{HoldComplete, InterpretationBox, MakeBoxes, Parenthesize, Unevaluated}


Created by Mathematica  (May 16, 2004)

Back to Ted’s Tricks index page