SubsetReplace
SubsetReplace(list, sublist -> rhs)
or
SubsetReplace(list, sublist :> rhs)
replaces the sublist pattern expression
sublist
inlist
with the right-hand-siderhs
.
Note: this function doesn’t support pattern sequences at the moment.
Examples
>> SubsetReplace({a,b,c,d},{x_,y_} :> f(x,y)){f(a,b),f(c,d)}