Source/Packages

Model.Word32

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

400 lines41 declarations16.0 KiBSHA-256 cb521ab16bb6

def · lines 386–400

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.
386def modelWord32FromDecimalDigitsTruncated =
387  (lambda unrestricted digits : Bytes .
388    app
389      (bytes-eliminate
390        (lambda unrestricted current : Bytes .
391          pi unrestricted accumulator : (family ModelWord32) . family ModelWord32)
392        (lambda unrestricted accumulator : (family ModelWord32) . accumulator)
393        (lambda unrestricted head : Byte .
394          unrestricted tail : Bytes .
395          unrestricted induction : (pi unrestricted accumulator : (family ModelWord32) . family ModelWord32) .
396          unrestricted accumulator : (family ModelWord32) .
397          induction
398            (modelWord32Add (modelWord32TimesTen accumulator) (modelWord32DecimalDigit head)))
399        digits)
400      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.