Bytes.split.cut: def of bend-kit-bytes@0.3.3.0 Import: import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes Lines 512-520 of bend-kit-bytes@0.3.3.0/bytes.bend: https://jend.leeeet.dev/read.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&start_line=512&end_line=520 import Base # r holds the buffer and the piece that ends at end; each earlier cut j starts one at j + m. def split.cut(cuts: List<&2, U32>, r: Bytes & Bytes, +end: U32, +m: U32, acc: List<&1, Bytes>) -> List<&1, Bytes>: match cuts: case Nil{}: (b, piece) = r Con{snd(slice(b, 0, end)), Con{piece, acc}} case Con{+j, t}: (b, piece) = r split.cut(t, slice(b, (j + m : U32), (end - j - m : U32)), j, m, Con{piece, acc}) Uses (9): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Pair https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Sigma https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.add https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.sub https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=Bytes https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=slice https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=snd