def Int.show.go

bend-kit-int@0.2.0.0 · int.bend:339

import bend-kit-int@0.2.0.0/int.bend as Int
import Base

339# z is set once the value left to print is zero; fuel n bounds the digits.
340def Int.show.go(f: Nat, +n: Nat, +b: Word(n), acc: String, z: Bool,
341  qr: Word(n) & Word(n)) -> String:
342  match f:
343    case 0n:
344      acc
345    case 1n+g:
346      match z:
347        case True{}:
348          acc
349        case False{}:
350          (q, r) = qr
351          +q2 = {q : Word(n)}
352          Int.show.go(g, n, b,
353            SCon{Radix.digit(U32.from_nat(Word.to_nat(n, r))), acc},
354            Int.is_zero(n, q2), Int.udivmod.go(n, q2, n, b))

Uses (11)

Used by (1)