Source/Packages

Model.Word32

packages/foundation/standard/src/Model/Word32.alpha

481 lines41 declarations16.9 KiBSHA-256 56a6cf48ff83

def · lines 467–481

modelWord32FromDecimalDigitsTruncated

Full file
Decimal digit bytes, most significant first, to a word modulo 2^32; one step per digit. Callers check the bytes are digits and the value fits.
467def modelWord32FromDecimalDigitsTruncated =
468  (lambda unrestricted digits : Bytes .
469    app
470      (bytes-eliminate
471        (lambda unrestricted current : Bytes . pi unrestricted accumulator : (family ModelWord32) .
472          family ModelWord32)
473        (lambda unrestricted accumulator : (family ModelWord32) . accumulator)
474        (lambda unrestricted head : Byte .
475          unrestricted tail : Bytes .
476          unrestricted induction : (pi unrestricted accumulator : (family ModelWord32) . family ModelWord32) .
477          unrestricted accumulator : (family ModelWord32) .
478          induction
479            (modelWord32Add (modelWord32TimesTen accumulator) (modelWord32DecimalDigit head)))
480        digits)
481      modelWord32Zero)

The compiler supplied declaration spans and resolved links from this source snapshot. This page does not assert that this file belongs to a checked closure.