SubsetCases
SubsetCases(list, sublist -> rhs)
or
SubsetCases(list, sublist :> rhs)
returns a list of the right-hand-side
rhs
for the matching sublist pattern expressionsublist
inlist
.
SubsetCases(list, sublist)
returns a list of the matching sublist pattern expressions
sublist
inlist
.
Note: this function doesn’t support pattern sequences at the moment.
Examples
>> SubsetCases({a,b,c,d},{x_,y_} :> f(x,y)){f(a,b),f(c,d)}
>> SubsetCases({a,b,c,d},{x_,y_}){{a,b},{c,d}}