BlankNullSequence

(three characters) or BlankNullSequence[]
is a pattern object that can stand for any sequence of zero or more Wolfram Language expressions.

or BlankNullSequence[h]
can stand for any sequence of expressions, all of which have head h.

DetailsDetails

  • Blank sequences work slightly differently depending on whether or not the head of the expression in which they appear is a symbol with the attribute Flat.
  • Consider matching the pattern against the expression . If f is a symbol with attribute Flat, then the will be taken to stand for the expression . If f is not a symbol with attribute Flat, then will be taken to stand for the sequence of expressions , . With a named pattern, such as , x can be used only as an element in an expression. The sequence of expressions , is "spliced in" to replace x, thereby usually increasing the length of the expression.
  • If matches a sequence of length more than one, then the sequence will be represented by a Sequence object. In most uses of , however, the Sequence object will automatically be spliced into another expression, and will never appear explicitly.

ExamplesExamplesopen allclose all

Basic Examples  (3)Basic Examples  (3)

A function that works with any number of arguments:

In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
Out[2]=

A function that works with any number of integer arguments:

In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
Out[2]=

A function that works with an integer followed by any number of arguments:

In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
Out[2]=
Introduced in 1988
(1.0)