Lately I recommend the following as introductory material:
-
Setting up and getting familiar with basics of the tooling around the language: Installing OCaml · OCaml Documentation A Tour of OCaml · OCaml Documentation
-
I second the recommendation for the CS3110 course:
It has exercises too, which is the only way to really learn anything. Otherwise if you don’t actually try things out in the practice you may realize that you haven’t actually fully understood the material, or that the material hasn’t covered everything and there is a crucial piece missing that you have to discover for yourself. You don’t have to do all the exercises (some of them are more “algorithmic” exercises than about learning the language), but doing a few is recommended.
- Chapters 1 through 11 from RealWorldOCaml. I still think it is useful, even though I’m not a fan of
Core(the projects I work on day-to-day don’t use it, and there is considerable resistance in the community about projects depending on it). An appropriate warning that the book uses a separate library should be sufficient for newcomers though. It is more consistent than the standard library (e.g. datastructures have labeled arguments so you don’t have to learn that Map and Hashtbl take their arguments in different order), and discouraging the use of polymorphic comparison is good for learning (once you have a data structure more complex than a tuple or some records you really want to avoid polymorphic comparison, and if you learn this early on it, then it avoids making mistakes later).
It has its downsides: reliance onppxes, and as pointed outMapandSetbeing considerably more complicated to use (try writing a recursive data type that has a Map or Set, it requires writing it in a certain way with Map.M/Set.M for the provided sexp derivation to work without a compiler error that is not really explained anywhere…).
HoweverBasehas improved a lot over the years, including the generated documentation (even though there are still completely undocumented functions in some modules), and in some sense the book complements the documentation.
I think this one is for those who are beginners to programming as well, and I can’t judge how well suited it’d be for that purpose (usually the people I recommend OCaml learning material for already know another programming language)