def run.go
import bend-kit-json@0.7.0.0/json.bend as Jsonimport Base
212# g bounds the loop; it is the parser's fuel, shared, so no count is built per run.
213def run.go(~ok: @+c: U32 -> Bool, g: Nat, r: Array<U32> & U32 & Bool, +len: U32, +i: U32) -> Array<U32> & U32 & U32:
214 match g:
215 case 0n:
216 (a, +c, more) = r
217 (a, i, c)
218 case 1n+h:
219 (a, +c, more) = r
220 match more:
221 case True{}:
222 run.go(~ok, h, run.cls(~ok, pk(a, len, (i + 1 : U32))), len, (i + 1 : U32))
223 case False{}:
224 (a, i, c)