def split
import bolt@1.27.0.0/src/lsp/frame.bend as Frameimport Base
336# the first ds bytes (reversed onto acc) and the rest, or not yet when there
337# are fewer. The count goes down a digit at a time: never a Nat of its size
338def split(xs: List<&2, U32>, +ds: List<&2, Digit>, +acc: List<&2, U32>) -> Cut:
339 match xs:
340 case Nil{}:
341 split.on(count.zero(ds), [], acc, _u => More{})
342 case Con{+h, +t}:
343 split.on(count.zero(ds), h <> t, acc, _u => split(t, untick(ds), h <> acc))