gives a list of the sublists in list that match the pattern patt in any order.
gives a list of the values of rhs corresponding to matching sublists.
includes only the first n matches.
Details and Options
- In SubsetCases[list,patt], patt can be an expression with head List that includes pattern constructs such as PatternSequence, Repeated (..), Blank (_) and BlankSequence (__).
- The pattern patt can also be a pattern that matches a list but does not itself have head List.
- With the default option setting OverlapsFalse, SubsetCases includes only sublists that do not overlap. With the setting OverlapsTrue, it includes sublists that overlap.
Examplesopen allclose all
For a variable-length pattern, SubsetCases returns the longest match:
Properties & Relations (3)
The result is equivalent to that of SubsetCases:
Find the same result using Subsets:
Wolfram Research (2020), SubsetCases, Wolfram Language function, https://reference.wolfram.com/language/ref/SubsetCases.html.
Wolfram Language. 2020. "SubsetCases." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/SubsetCases.html.
Wolfram Language. (2020). SubsetCases. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SubsetCases.html