def cut
import lawful-fields@0.1.1.0/fields.bend as Fieldsimport Base
import lawful-bytes@0.1.1.0/defs.bend as D
37# The end offsets of the first n pieces of bytes from .. to-1, split at sep:
38# each end is where a separator is, or to for the last piece.
39def cut(b: D.Bytes, +from: U32, +to: U32, +sep: U32, +n: Nat) -> D.Bytes & List<&2, U32>:
40 cut.go(n, True{}, cut.next(Bool.not(Nat.is_eq(n, 0n)), b, from, to, sep), to, sep)