OCaml tutorials
Your Help is Needed
Some of these tutorials need updating and tutorials on new topics are needed. You can contribute by visiting this project's repo on GitHub; you may use the issue tracker there to request or offer new tutorials.
Getting Started
- Up and Running
- Basics
- Structure of OCaml Programs
- Modules
- Filenames and Extensions
- OCaml Programming Guidelines
Language Features
- Data Types and Matching
- Functional Programming
- If Statements, Loops, and Recursion
- Labels
- Pointers in OCaml
- Null Pointers, Asserts, and Warnings
- Objects
Data Structures
Errors
Common Tasks
- Formatting and Wrapping Text
- 99 Problems (solved) in OCaml
- Introduction to Gtk
- Command-Line Arguments
- File manipulation
Interoperability
Other Build Systems
Advanced Topics
External Links
Learn by Doing
- Try OCaml Online allows you to immediately start learning OCaml in your browser, without installing it. Compiled as a single Javascript page, it gives you the full power of OCaml, even when your are disconnected from the network.
- PLEAC-OCaml provides OCaml solutions to the complete set of problems originally posed in the very successful Perl Cookbook. OCaml is one of only 3 languages for which the full set of solutions has been provided.
- Rosetta is a programming chrestomathy site. It provides solutions to the same task in many languages. Currently there are few tasks with OCaml solutions provided, but perhaps you would like to add new solutions.
Tutorials on OCaml
- The OCaml System is the official user's manual. The first part provides an introduction to the core language, objects and classes, and modules. Previous versions are here.
- OCaml for scientific computation covers a broad sample of OCaml, from the basics to the C API.
- OCaml for Haskellers Some notes on the differences between OCaml and Haskell.
WikiBooks on OCaml
Both in french:
- fr.wikibooks.org/wiki/OCaml Introduction on functional programming using OCaml.
- fr.wikiversity.org/wiki/Premiers_pas_en_OCaml The basics of the OCaml language.
Tutorials on Tools and Other Articles
- Camlp5, a Pre-Processor-Pretty-Printer for OCaml.
- A Guide to Extension Points in OCaml, on using PPX, the syntax extensions API.
- Detecting use cases for GADTs in OCaml, on using generalized algebraic data types in writing interpreters.