def rd.nats
import bend-kit-runner@0.13.0.1/runner.bend as Runnerimport Base
841def rd.nats(+fuel: Nat, end: Bool, +n: U32) -> Dec(List<&2, Nat>):
842 match fuel end:
843 case 0n b:
844 Dec.fail(List<&2, Nat>)
845 case 1n+f True{}:
846 Dec.pure(List<&2, Nat>, Nil{})
847 case 1n+f False{}:
848 +k = (n - 1 : U32)
849 do Dec<List<&2, Nat>>:
850 x : Nat <- rd.u64()
851 rest : List<&2, Nat> <- rd.nats(f, U32.is_eq(k, 0), k)
852 return Con{x, rest}