ReplacePart
Usage
• ReplacePart[expr, new, n] yields an expression in which the n part of expr is replaced by new. • ReplacePart[expr, new, {i, j, ... }] replaces the part at position {i, j, ... }. • ReplacePart[expr, new, {{ , , ... }, { , , ... }, ... }] replaces parts at several positions by new. • ReplacePart[expr, new, pos, npos] replaces parts at positions pos in expr by parts at positions npos in new.
Notes
• The list of positions used by ReplacePart is in the same form as is returned by the function Position. • ReplacePart[expr, Hold[new], pos, 1] can be used to replace a part without evaluating it. • If pos and npos both specify multiple parts, each part in pos is replaced by the corresponding part in npos. • New in Version 2; modified in 3.
|