SequenceCases is not performing as expected. Here's an example to illustrate: Find all the triples where the pair {hi, mid} precedes {hi,lo} and {hi,lo} precedes {mid,lo} in an ordered list, where hi > mid > lo.
list = {{6, 3}, {6, 1}, {6, 2}, {3, 1}, {3, 2}};
SequenceCases[list,
{{hi_, mid_}, ___,
{aa_, lo_}, ___,
{bb_, cc_}} /;
lo < mid < hi &&
aa == hi &&
bb == mid &&
cc == lo -> {{hi, mid}, {mid, lo}}, Overlaps -> True]
Inspection identifies two triples:
- {6,3} precedes {6,2} which precedes {3,2} and
- {6,3} precedes {6,1} which precedes {3,1}
But SequenceCases only returns the first one: {{{6,3},{3,2}}}.
I was careful to put the BlankNullSequence "___" between the Rules. Am I missing something?