ocaml: phase 6 Bool module + Option.equal/Option.compare (+5 tests, 584 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 50s

Bool module:
  equal a b      = a = b
  compare a b    = 0 if equal, 1 if a, -1 if b (false < true)
  to_string      'true' / 'false'
  of_string s    = s = 'true'
  not_           wraps host not
  to_int         true=1, false=0

Option additions (take eq/cmp parameter for the inner value):
  equal eq a b   None=None, otherwise eq the inner values
  compare cmp a b  None < Some _; otherwise cmp inner

  Option.equal (=) (Some 1) (Some 1)        = true
  Option.equal (=) (Some 1) None             = false
  Option.compare compare (Some 5) (Some 3)  = 1
This commit is contained in:
2026-05-09 06:26:33 +00:00
parent ddd1e40d00
commit 4d32c80a99
3 changed files with 49 additions and 0 deletions

View File

@@ -407,6 +407,12 @@ _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 6 — Bool module + Option.equal / Option.compare
(+5 tests, 584 total). Bool: equal, compare (false < true via if
ladder), to_string, of_string, not_, to_int. Option additions
take an `eq` or `cmp` parameter for the inner-value check, mirroring
real OCaml's signature: `Option.equal eq a b`, `Option.compare cmp
a b`. None < Some _ for compare.
- 2026-05-09 Phase 5.1 — bag.ml baseline + String.equal/compare/cat/
empty (+3 tests, 579 total). bag.ml: split a sentence on spaces,
count word frequency in a Hashtbl, return the maximum count.