Details and Options
ResourceFunction["MultiReplace"] returns an association with keys containing a rule index and list of positions of a tuple/subset of subexpressions where the corresponding rule was applied.
If one rule is given, keys contain positions only.
Association values are results of applying
ReplaceList at corresponding positions, so for a given position multiple results of substitution are possible.
The left-hand side of a rule can be a list or a custom
head to replace tuples/subsets of subexpressions, similar to
SequenceReplace and
SubsetReplace but for all positions.
When a tuple is specified as a left-hand side, replacement applies at multiple positions where all elements of a tuple match, meaning each position can be replaced multiple times.
In contrast, with
"Subsets"→True option, multiple positions are considered where elements of a subset match, i.e. only disjoint positions are considered.
If a rule returns a list (or a head) of expressions, they are substituted for the corresponding tuple/subset positions on the left-hand side.
ResourceFunction["MultiReplace"] takes the same options as the resource function
SubexpressionPositions for subexpression selection.
ResourceFunction["MultiReplace"] takes the following options:
"Subsets" | False | whether to look for tuples or subsets |
Method | "Substitution" | substitution strategy to use: "Susbtitution", "Cosubstitution" or "Bisubstitution" |