def cut.go
import bend-kit-csv@0.3.0.0/csv.bend as Csvimport Base
import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes
164# Spans latest first give fields in order.
165def cut.go(sp: List<&2, Span>, r: Array<U32> & List<&1, Bytes.Bytes>) -> Array<U32> & List<&1, Bytes.Bytes>:
166 match sp:
167 case Nil{}:
168 r
169 case Con{Span{+s, +e, +esc}, t}:
170 (a, acc) = r
171 +m = (e - s : U32)
172 cut.go(t, cut.fin(m, esc, Bytes.copy(m, a, Bytes.alloc(m), s, 0), acc))