WolframLang: Functions that Transform Expression by Rules
Functions that Transform Expression by Rules
The following functions take a expression and a rule or list of rules, and transform expression accordingly.
ReplaceAll[expr, rules]
-
🔸 SHORT SYNTAX:
expr /. rules
- Replace expr by transformation rules rules.
- rules can be a single rule or a list of rules.
Note: this is the most frequently used.
ReplaceRepeated[expr, rules]
-
🔸 SHORT SYNTAX:
expr //. rules
repeatedly performs replacements until expr no longer changes.
Replace[expr, rules, levelSpec]
-
applies a rule or list of rules in an attempt to transform the entire expression, at levelSpec
ReplaceAt[expr, rules, positionSpec]
-
transforms expr by replacing the particular positions using rules
ReplaceList[expr, rules]
-
transform the entire expression by applying a rule or list of rules in all possible ways, and returns a list of the results obtained.