Wolfram Language & System 10.0 (2014)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.View current documentation (Version 11.2)


yields an expression in which the ^(th) part of expr is replaced by new.

replaces parts at positions by .

replaces the part at position .

replaces parts at positions by .

replaces all parts at positions by new.

represents an operator form of ReplacePart that can be applied to an expression.

Details and OptionsDetails and Options

  • Explicit negative part numbers count from the end. »
  • Part position specifications can be patterns.
  • Each pattern is effectively tested against each list of part numbers for parts in expr.
  • Patterns p (such as ) that are not explicitly lists are treated as {p}.
  • Patterns can include constructs such as , representing position specifications of variable lengths.
  • ReplacePart[expr,i:>new] can be used to replace a part without first evaluating it. With a rule such as , new is evaluated separately for each position that matches patt.
  • With the default option setting Heads->Automatic, a head is replaced only when the corresponding position specification is explicitly .
  • With Heads->True a head is replaced whenever the corresponding position specification matches .
  • Heads->False never replaces heads.
  • ReplacePart can be used on SparseArray objects.
Introduced in 1991
| Updated in 2014