Files
rose-ash/lib
giles ac19b7aced
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 24s
ocaml: phase 5.1 bigint_add.ml baseline (digit-list bignum add, 1+18+9 = 28)
Recursive 4-arm match on (a, b) tuples threading a carry:

  match (a, b) with
  | ([], []) -> if carry = 0 then [] else [carry]
  | (x :: xs, []) -> (s mod 10) :: aux xs [] (s / 10)   where s = x + carry
  | ([], y :: ys) -> ...
  | (x :: xs, y :: ys) -> ...                           where s = x + y + carry

Little-endian digit lists. Three tests:

  [9;9;9] + [1]                 = [0;0;0;1]      (=1000, digit sum 1)
  [5;6;7] + [8;9;1]             = [3;6;9]        (=963, digit sum 18)
  [9;9;9;9;9;9;9;9] + [1]       length 9         (carry propagates 8x)

Sum = 1 + 18 + 9 = 28.

Exercises tuple-pattern match on nested list-cons with the integer
arithmetic and carry-threading idiom typical of multi-precision
implementations.

52 baseline programs total.
2026-05-09 11:19:23 +00:00
..