Hi, beginner here, again. Thanks for looking.
I would like to “partition” this list from given
{1, 2, 3, 8, 4, 2, 6, 7, 3, 2, 1, 9, 8, 9, 1, 3, 1, 2, 9, 2, 8, 2, 7, 7, 1, 2, 3, 4, 3, 2, 1};
into output (for further processing), either or:
{{1, 2, 3}, {8, 4, 2, 6, 7, 3, 2, 1}, {9, 8, 9, 1, 3, 1}, {2, 9, 2, 8, 2, 7, 7, 1, 2, 3}, {4, 3, 2}, {1}};
{{1, 2, 3}, {8, 4, 2, 6, 7, 3, 2, 1}, {9, 8, 9, 1, 3, 1}, {2, 9, 2, 8, 2, 7, 7, 1, 2, 3}, {4, 3, 2}};
That is a clear partioning cut, whenever the last three numbers are “LessThan5”, no matter if the next number(s) are <5 too, i.e. without Overlaps. My gut feeling is that we would use the SequenceCases function, or maybe SequenceSplit or SequenceReplace, but I can’t figure out how.
((A different approach would be programming a short algorithm with iterations/procedures/loops, but let’s figure out the functional approach first, maybe with conditional pattern matching.))
Thank You!