def run_len2

lawful-bytes@0.1.1.0 · defs.bend:65

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

65# How many leading elements are neither c1 nor c2.
66def run_len2(xs: List<&2, U32>, +c1: U32, +c2: U32) -> Nat:
67  match xs:
68    case Nil{}:
69      0n
70    case Con{+x, t}:
71      Bool.pick(Nat, U32.is_eq(x, c1) || U32.is_eq(x, c2), 0n, Nat.add(1n, run_len2(t, c1, c2)))

Uses (7)

Used by (18)