Splice
Splice[{e1,e2,…}]
represents an expression that will automatically be spliced into any list in which it appears as the sequence of elements ei.
Splice[{e1,e2,…},hpatt]
represents an expression that will automatically be spliced into any expression whose head matches the pattern hpatt.
Examples
open allclose allBasic Examples (3)
Scope (3)
Splice a list of elements into another list:
The same object does not splice into expressions with other heads:
Splice a list of elements into an expression with a given head:
The same object does not splice into expressions with other heads:
Splice a list of elements into an expression whose head matches a given pattern:
Properties & Relations (5)
Splice[{e1,e2,…}] behaves like Sequence[e1,e2,…] inside a list:
Sequence objects also splice inside other heads, but not one-argument Splice objects:
Splice[{e1,e2,…},_] behaves like Sequence[e1,e2,…] under evaluation:
Splice[{}] is equivalent to Nothing:
FlattenAt[list,pos] is equivalent to MapAt[Splice,list,pos]:
Splice may be resolved inside functions with the HoldAll, HoldFirst, and HoldRest attributes:
It is not resolved inside functions with the HoldAllComplete attribute, as this attribute blocks upvalues:
Splice is also not resolved when nested deeply inside a held expression:
Possible Issues (1)
Unlike Sequence, the action of Splice cannot be blocked using Unevaluated:
Instead, use Block if it is necessary to temporarily deactivate Splice:
Text
Wolfram Research (2020), Splice, Wolfram Language function, https://reference.wolfram.com/language/ref/Splice.html (updated 2022).
CMS
Wolfram Language. 2020. "Splice." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2022. https://reference.wolfram.com/language/ref/Splice.html.
APA
Wolfram Language. (2020). Splice. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Splice.html