Skip to content

About

Learn OCaml interactively — a 20-lesson course with two implementations: a Textual TUI and a browser-based React SPA, both validating your code against a real OCaml compiler.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

Repository files navigation

OCamlLearn

20 short lessons. Each one explains a concept, then asks you to write real OCaml and checks it against a real compiler — not a string match.

Try it → ocamllearn.vercel.app — nothing to install, runs in your browser.

Screenshot

Two implementations, same lesson content:

  • web/ — React SPA. OCaml runs entirely in your browser (a js_of_ocaml toplevel), no backend, no signup. Deep-linkable lessons, works on mobile.
  • ocamllearn/ — Textual TUI. Runs your code through a local opam/ocaml install.

Lesson content lives once, in lessons/ (Markdown + TOML), and is shared by both.

Run it

Web:

cd web
npm install
npm run dev

Terminal:

opam init -y          # once, if you don't have an OCaml switch yet
uv run ocamllearn

Topics

Values, functions, pattern matching, lists, recursion, higher-order functions, options, results/exceptions, records, variants, polymorphism, labeled arguments, mutability, loops/arrays, Printf, modules.

How the checking works

Each exercise pairs your code with a hidden test snippet that calls it and prints PASS/FAIL per assertion. Both implementations compile and run that combined snippet with the real OCaml toolchain, then parse the output — so a wrong answer gets a real type error or a real failing assertion, not a canned response.

Contributing lessons

Add a lessons/NN-slug/lesson.md + exercises.toml pair (see any existing lesson for the format), then run scripts/export_lessons.py to regenerate web/src/lessons.json.

About

Learn OCaml interactively — a 20-lesson course with two implementations: a Textual TUI and a browser-based React SPA, both validating your code against a real OCaml compiler.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages