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.

Details

  • Splice[{}] is equivalent to Nothing.
  • Splice[{e1,e2,}] is equivalent to Sequence[e1,e2,] when the outer wrapping head is List.
  • Splice is resolved as part of the standard evaluation process. It is not resolved in expressions that are held or inactive.

Examples

open allclose all

Basic Examples  (2)

Give a list of elements to be spliced into a surrounding list:

Splice expressions do not automatically flatten inside other heads:

Flatten a list of lists inside another list:

Applications  (1)

Splice a list into another list:

Properties & Relations  (2)

Splice[{e1,e2,}] behaves like Sequence[e1,e2,] inside a list:

Sequence objects also splice inside other heads, but not Splice objects:

Splice[{}] is equivalent to Nothing:

Introduced in 2020
 (12.1)