def same.go

lawful-bytes@0.1.1.0 · bytes.bend:116

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

116# ra, rb hold byte i of a and byte j of b; acc says all bytes so far matched.
117def same.go(n: Nat, ra: D.Bytes & U32, rb: D.Bytes & U32, +i: U32, +j: U32, acc: Bool) -> D.Bytes & (D.Bytes & Bool):
118  match n:
119    case 0n:
120      (a, x) = ra
121      (b, y) = rb
122      (a, (b, acc))
123    case 1n+k:
124      (a, +x) = ra
125      (b, +y) = rb
126      same.go(k, at(a, (i + 1 : U32)), at(b, (j + 1 : U32)), (i + 1 : U32), (j + 1 : U32), acc && U32.is_eq(x, y))

Uses (10)

Used by (3)