ocaml: phase 5.1 reverse_int.ml baseline (digit-reverse sum = 54329)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 24s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 24s
Walks digits via mod 10 / div 10, accumulating the reversed value:
let reverse_int n =
let m = ref n in
let r = ref 0 in
while !m > 0 do
r := !r * 10 + !m mod 10;
m := !m / 10
done;
!r
reverse 12345 + reverse 100 + reverse 7
= 54321 + 1 + 7
= 54329
Trailing zeros collapse (reverse 100 = 1, not 001).
132 baseline programs total.
This commit is contained in:
@@ -407,6 +407,11 @@ _Newest first._
|
||||
binary search tree (`type 'a tree = Leaf | Node of 'a * 'a tree *
|
||||
'a tree`) with insert + in-order traversal. Tests parametric ADT,
|
||||
recursive match, List.append, List.fold_left.
|
||||
- 2026-05-10 Phase 5.1 — reverse_int.ml baseline (digit-reverse,
|
||||
reverse(12345) + reverse(100) + reverse(7) = 54321 + 1 + 7 =
|
||||
54329). Walks digits via mod 10 / div 10, accumulating the
|
||||
reversed value. Trailing zeros collapse (reverse 100 = 1).
|
||||
132 baseline programs total.
|
||||
- 2026-05-10 Phase 5.1 — bowling.ml baseline (10-pin bowling score
|
||||
for canonical "167" PBA-style game). Walks pin-knockdown list
|
||||
applying strike/spare bonuses through a 10-frame counter. Strike
|
||||
|
||||
Reference in New Issue
Block a user