law cut_view
import lawful-fields@0.1.1.0/LAWS.bend as LAWSimport Base
import lawful-bytes@0.1.1.0/defs.bend as D
import lawful-fields@0.1.1.0/defs.bend as F
import lawful-fields@0.1.1.0/fields.bend as C
9# cut answers the end offsets of the first n pieces of from .. to-1, split at
10# sep: the pieces those ends delimit are the first n of F.split.
11law cut_view:
12 for b: D.Bytes
13 for d: Nat
14 for from: U32
15 for to: U32
16 for sep: U32
17 for n: Nat
18 for h: {D.ok(b, d) == True{} : Bool}
19 for hft: {U32.is_le(from, to) == True{} : Bool}
20 for ht: {Nat.is_le(U32.to_nat(to), D.size(b)) == True{} : Bool}
21 for hs: {U32.is_lt(sep, 256) == True{} : Bool}
22 {F.pieces(Pair.snd(D.Bytes, List<&2, U32>, C.cut(b, from, to, sep, n)), D.view(b), U32.to_nat(from)) == List.take(&2, List<&2, U32>, F.split(D.slice(D.view(b), U32.to_nat(from), Nat.sub(U32.to_nat(to), U32.to_nat(from))), sep), n) : List<&2, List<&2, U32>>}
Uses (21)
Used by (0)
No other definition uses this definition.