PatternSequence

PatternSequence[p1,p2,]

is a pattern object which represents a sequence of arguments matching p1, p2, .

Details

  • PatternSequence[] represents a sequence of zero length.
  • PatternSequence can appear anywhere inside a pattern but cannot be the only element of a pattern.

Examples

open allclose all

Basic Examples  (2)

Replace a subsequence in a list:

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

Match a periodic pattern:

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

Scope  (2)

See Also

Repeated  Optional  Alternatives  Pattern  Sequence  OrderlessPatternSequence  FixedOrder  KeyValuePattern

Tutorials

Introduced in 2007
(6.0)