def pieces

lawful-fields@0.1.1.0 · defs.bend:94

import lawful-fields@0.1.1.0/defs.bend as Defs
import Base
import lawful-bytes@0.1.1.0/defs.bend as D

94# The pieces of xs that end at each offset of es, the first starting at from
95# and each next one just after the previous end (where the separator was).
96def pieces(es: List<&2, U32>, +xs: List<&2, U32>, +from: Nat) -> List<&2, List<&2, U32>>:
97  match es:
98    case Nil{}:
99      Nil{}
100    case Con{+e, t}:
101      Con{D.slice(xs, from, Nat.sub(U32.to_nat(e), from)), pieces(t, xs, Nat.add(U32.to_nat(e), 1n))}

Uses (7)

Used by (6)