Repeated

p.. or Repeated[p]

is a pattern object that represents a sequence of one or more expressions, each matching p.

Repeated[p,max]

represents from 1 to max expressions matching p.

Repeated[p,{min,max}]

represents between min and max expressions matching p.

Repeated[p,{n}]

represents exactly n expressions matching p.

Details

  • p.. can appear as an argument of any function. It represents any sequence of arguments.
  • All the objects in the sequence represented by p.. must match p, but the objects need not be identical.
  • The expression p may, but need not, itself be a pattern object.

Examples

open allclose all

Basic Examples  (2)

Replace any list of a's by x:

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

Replace any list of f's with one argument:

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

Scope  (5)

Applications  (1)

Possible Issues  (2)

See Also

RepeatedNull  BlankSequence  PatternSequence  Longest  Shortest  StringExpression  RepeatingElement

Tutorials

Introduced in 1988
(1.0)
| Updated in 2007
(6.0)