def lead.count
import cswap-bend-cli@0.1.0.0/fmt/yamlr.bend as Yamlrimport Base
33# Leading spaces; a tab in the indentation is an error (-1 is not a Nat, so
34# the flag travels beside).
35def lead.count(s: String, +n: Nat) -> Nat:
36 match s:
37 case SCon{Chr{c}, t}:
38 Bool.pick(Nat, U32.is_eq(c, 32), lead.count(t, Nat.add(n, 1n)), n)
39 case SNil{}:
40 n