Files
rose-ash/lib/ocaml/baseline/expected.json
giles 9a8bbff5b2
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 23s
ocaml: phase 5.1 json_pretty.ml baseline (recursive ADT to string, len = 24)
Defines a JSON-like algebraic data type:

  type json =
    | JNull
    | JBool of bool
    | JInt of int
    | JStr of string
    | JList of json list

Recursively serialises to a string via match-on-constructor, then
measures the length:

  JList [JInt 1; JBool true; JNull; JStr 'hi'; JList [JInt 2; JInt 3]]
  -> '[1,true,null,"hi",[2,3]]'   length 24

Exercises:
  - five-constructor ADT (one nullary, three single-arg, one list-arg)
  - recursive match
  - String.concat ',' (List.map to_string xs)
  - string-cat with embedded escaped quotes

34 baseline programs total.
2026-05-09 07:41:01 +00:00

39 lines
770 B
JSON

{
"anagrams.ml": 3,
"bag.ml": 3,
"balance.ml": 3,
"bfs.ml": 6,
"btree.ml": 39,
"brainfuck.ml": 75,
"caesar.ml": 215,
"calc.ml": 13,
"closures.ml": 315,
"csv.ml": 10,
"exception_handle.ml": 4,
"expr_eval.ml": 16,
"factorial.ml": 3628800,
"fraction.ml": 7,
"frequency.ml": 5,
"fizzbuzz.ml": 57,
"list_ops.ml": 30,
"json_pretty.ml": 24,
"lambda_calc.ml": 7,
"levenshtein.ml": 11,
"memo_fib.ml": 75025,
"merge_sort.ml": 44,
"module_use.ml": 3,
"mutable_record.ml": 10,
"option_match.ml": 5,
"pi_leibniz.ml": 314,
"poly_stack.ml": 5,
"queens.ml": 2,
"quicksort.ml": 44,
"roman.ml": 44,
"safe_div.ml": 20,
"shuffle.ml": 55,
"sieve.ml": 15,
"sum_squares.ml": 385,
"unique_set.ml": 9,
"word_count.ml": 3
}