def Mag.digits

bend-kit-bignum@0.1.0.0 · bigint.bend:315

import bend-kit-bignum@0.1.0.0/bigint.bend as Bigint
import Base

315# The digit values of s, last first, and whether every char was a digit.
316def Mag.digits(s: String, ok: Bool, acc: List<&2, U32>) ->
317  Bool & List<&2, U32>:
318  match s:
319    case SNil{}:
320      (ok, acc)
321    case SCon{Chr{c}, t}:
322      +d = (c - 48 : U32)
323      Mag.digits(t, Bool.and(ok, U32.is_lt(d, 10)), Con{d, acc})

Uses (10)

Used by (1)