def at.go

bend-kit-bytes@0.3.3.0 · bytes.bend:411

import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes
import Base

411# Does needle match at j? ok is the previous byte's result; the first mismatch stops the walk.
412def at.go(needle: String, ok: Bool, r: Array<U32> & U32, +j: U32) -> Array<U32> & Bool:
413  match needle:
414    case SNil{}:
415      (a, v) = r
416      (a, ok)
417    case SCon{Chr{+c}, t}:
418      match ok:
419        case False{}:
420          (a, v) = r
421          (a, False{})
422        case True{}:
423          (a, +v) = r
424          at.go(t, U32.is_eq(v, c), peek(a, (j + 1 : U32)), (j + 1 : U32))

Uses (10)

Used by (1)