Lessons
OCaml · Medium
OCaml · Medium. Ten lessons. Open-book quizzes. Lesson 1 free.
10 lessons · The Host · Lesson 1 free
Pass all ten lessons for the certificate. Sample · Claim

Lesson 1 · On the house
Signatures and abstract types
module type, sig ... end, hiding representations, and .mli files.

Lesson 2
Functors
Modules parameterized by modules: Set.Make, Map.Make, and writing your own.

Lesson 3
First-class modules
Packing modules as values, (module M : S), and choosing implementations at runtime.

Lesson 4
Polymorphic variants
Backtick tags, open and closed variant types, and structural typing.

Lesson 5
Binding operators
let* and let+ for result and option, and writing monadic code clearly.

Lesson 6
Lazy values
lazy, Lazy.force, memoization, and lazy infinite structures.

Lesson 7
Tail recursion and stack safety
Accumulators, List.rev, rev_map, and recognizing non-tail calls.

Lesson 8
Bytes, Buffer and efficient text
Mutable Bytes, Buffer growth, String.concat, and avoiding quadratic ^.

Lesson 9
Format and pretty-printers
Format.printf, %a with custom printers, boxes, and deriving show.

Lesson 10
Testing OCaml code
dune test, Alcotest checks, and ppx_expect snapshot tests.
Sample certificate
Certificate of completion
Sign in to claim your certificate of completion.
Certificate
Finish all ten lessons, then sign in
Pass every lesson on this device (quizzes and checks). Then sign in or create an account to type your name and download the JPG.