ocaml: phase 5.1 fizz_classifier.ml baseline (FizzBuzz with polymorphic variants, 1..30 weighted = 540)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 31s

Two functions:
  classify n   maps i to a polymorphic variant
                  FizzBuzz | Fizz | Buzz | Num of int
  score x      pattern-matches the variant to a weight
                  FizzBuzz=100, Fizz=10, Buzz=5, Num n=n

For i in 1..30:
  FizzBuzz at 15, 30:                  2 * 100 = 200
  Fizz at 3,6,9,12,18,21,24,27:        8 *  10 =  80
  Buzz at 5,10,20,25:                  4 *   5 =  20
  Num: rest (16 numbers)                       = 240
                                          total = 540

Exercises polymorphic-variant match (iter 87) including a
payload-bearing 'Num n' arm.

105 baseline programs total.
This commit is contained in:
2026-05-09 20:56:31 +00:00
parent c8206e718a
commit 73917745a0
3 changed files with 29 additions and 0 deletions

View File

@@ -407,6 +407,13 @@ _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-09 Phase 5.1 — fizz_classifier.ml baseline (FizzBuzz with
polymorphic variants, 1..30 weighted score = 540). Two functions:
classify maps i → ` `FizzBuzz | `Fizz | `Buzz | `Num n``, and score
pattern-matches the variant to a weight (100/10/5/value). For
i=1..30: 200 + 80 + 20 + 240 = 540. Exercises polyvariant
match (iter 87) including a payload-bearing `` `Num n``. 105
baseline programs total.
- 2026-05-09 Phase 5.1 — max_product3.ml baseline (max product of
three from a list including negatives = 300). Sort, then compare
product of three largest vs product of two smallest negatives and