def dec_go
import bend-collections@1.0.0.0/src/crypto/argon2/phc.bend as Phcimport Base
214# The decimal digits of n before acc; fuel bounds the number of digits and
215# last says n < 10.
216def dec_go(fuel: Nat, +n: Nat, acc: String, last: Bool) -> String:
217 match fuel last:
218 case 0n _:
219 acc
220 case 1n+f True{}:
221 SCon{dchar(n), acc}
222 case 1n+f False{}:
223 +q = Nat.div(n, 10n)
224 dec_go(f, q, SCon{dchar(Nat.mod(n, 10n)), acc}, Nat.is_lt(q, 10n))