Code shared by patterns: split, more in the futurte.
abstract class base pattern[readonly value element type]
implements validatable, pattern[element type]
extends debuggable
implement immutable list[immutable list[element type]] split(immutable list[element type] the list)
result : base list[immutable list[element type]] • new()
var index : 0
loop
match : find first(the list, index)
if match is_not null
assert matchis not empty
resultappend(the listslice(index, matchbegin))
index = matchend
else
resultappend(the listskip(index))
break
return resultfrozen copy()