This is documentation for Mathematica 3, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)
 Documentation / Mathematica / Built-in Functions / Programming / Rule Application  /

  • expr //. rules repeatedly performs replacements until expr no longer changes.
  • expr //. rules effectively applies /. repeatedly, until the results it gets no longer change.
  • It performs one complete pass over the expression using /., then carries out the next pass.
  • You should be very careful to avoid infinite loops when you use the //. operator. The command x //. x -> x + 1 will, for example, lead to an infinite loop.
  • ReplaceRepeated takes the option MaxIterations, which specifies the maximum number of times it will try to apply the rules you give. The default setting is MaxIterations -> 65536. With MaxIterations -> Infinity there is no limit.
  • See the Mathematica book: Section 2.4.1.
  • See also: Rule, Set, FixedPoint.

    Further Examples

    See the Further Examples for ReplaceAll.