BlankSequence[]
__
BlankSequence
[h]__h
Use a BlankSequence
pattern to stand for a non-empty sequence of arguments:
MatchQ[f[1, 2, 3], f[__]]
MatchQ[f[], f[__]]
__
h will match only if all elements have head h:
MatchQ[f[1, 2, 3], f[__Integer]]
MatchQ[f[1, 2.0, 3], f[__Integer]]
The value captured by a named BlankSequence
pattern is a Sequence
object:
f[1, 2, 3] /. f[x__] -> x