Int.Nar.read.step: def of bend-kit-int@0.2.0.0 Import: import bend-kit-int@0.2.0.0/int.bend as Int Lines 537-547 of bend-kit-int@0.2.0.0/int.bend: https://jend.leeeet.dev/read.txt?path=bend-kit-int@0.2.0.0/int.bend&start_line=537&end_line=547 import Base # acc * r + d stays at most m exactly when acc <= (m - d) / r. def Nar.read.step(+r: U32, +m: U32, st: Maybe<&2, U32>, x: U32) -> Maybe<&2, U32>: match st: case None{}: None{} case Some{acc}: +a = {acc : U32} +d = {Radix.value(x) : U32} Nar.read.dig(Bool.and(U32.is_lt(d, r), U32.is_le(a, U32.div(U32.sub(m, d), r))), r, a, d) Uses (9): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.and https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Maybe https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.div https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.is_le https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.is_lt https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.sub https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Nar.read.dig https://jend.leeeet.dev/definition.txt?path=bend-kit-int@0.2.0.0/int.bend&name=Radix.value