I want to advertise OCaml to beginners, and I am looking for good tutorials in English; not that you have only heard of, but that you have actually tried and found useful...
Problems. We have observed that OCaml is really hard for beginners to learn without help. The main cause is the terribly poor reporting of static and dynamic errors.
I quite like the book Developing Applications With Objective Caml -- I guess the title should be updated to mirror the 'OCaml' naming decision. It is old and therefore slightly out-of-date, but on only minor aspects -- eg., it presents the stream syntax as belonging to the core language, but it is now outsourced as a Camlp4 extension. The book is surprisingly complete, and there is a lot of meat already in the chapters 2, 3 and 4.
This books covers a bit of system programming, but if it's what the reader is interested in, I would rather recommend the separate book Unix system programming in OCaml -- also translated into english by a community effort.
Finally, if one want to discover the theoretical underpinnings of OCaml, If found the U3 book, Using, Understanding, and Unraveling the OCaml Language to be a great resource. But it's only for readers that already know about OCaml.
PS: I have a very good opinion on Jason Hickey's introduction to Objective Caml as well, but I can't say I have read it in full, only glanced at it. That's the problem with "beginners" books, you can really read at most one good one.
For me, the primary one is:
$ apt-cache show ocaml-book-en
Package: ocaml-book-en
Source: ocaml-book
Version: 1.0-5
Installed-Size: 7061
Maintainer: Debian QA Group <[email protected]>
Architecture: all
Recommends: www-browser | pdf-viewer
Description-en: English book: "Developing applications with Objective Caml"
This is the English translation of the O'Reilly's OCaml French
book "Developpement d'applications avec Objective Caml" that can
be found in the ocaml-book-fr package.
.
This package contains both the HTML and PDF version of the book.
:)
There is also great book for system programming in OCaml and cookbook-style resource here.
The tutorial I used when learning and the one I always recommend to beginners - ocaml-tutorial.org (mirrored at ocamlcore as original site went down).
Here is a book that is intended for newcomers to programming and also those who know some programming but want to learn programming in the function-oriented paradigm, or those who simply want to learn OCaml.
An OCaml port of the book How to Think Like a Computer Scientist has been created by Nicolas Monje.
According to the website, the PDF version of the book should be downloaded
From the book:
The goal of this book is to teach you to think like a computer scientist. This way of thinking combines some of the best features of mathematics, engineering, and natural science. Like mathematicians, computer scientists use formal languages to denote ideas (specifically computations). Like engineers, they design things, assembling components into systems and evaluating tradeoffs among alternatives. Like scientists, they observe the behavior of complex systems, form hypotheses, and test predictions.
The single most important skill for a computer scientist is problem solving. Problem solving means the ability to formulate problems, think creatively about solutions, and express a solution clearly and accurately. As it turns out, the process of learning to program is an excellent opportunity to practice problem-solving skills. That’s why this chapter is called, “The way of the program.”
On one level, you will be learning to program, a useful skill by itself. On another level, you will use programming as a means to an end. As we go along, that end will become clearer.
I've just started with Ocaml, and these are tutorials that I find most helpful:
Documentation and user’s manual - most useful and official
Introduction to Caml - this one i used in my first days (recently) and it was really helpful because of it's simplicity
I thought Jason Hickey's Introduction to Objective Caml was very good (the only actual text on the language I've read, and how I started). INRIA's documentation is nice as well; and reading module signatures by themselves is quite instructive once you get the hang of it ;)
Believe it or not, OCaml was the first language I (really) learned.
There is a new book "Real World OCaml" of Jason Hickey is going to be published soon. On the web-site there is a public beta available for free. Despite the fact the book is not finished yet, I didn't notice any major mistakes or irrelevancies.
It gave me a full-fledged understanding of OCaml. It contains lots of examples illustrating concepts and could be easily considered as a tutorial. I also liked that it partly covers standart modules (List
, ListLabels
, Map
, Sys
, String
, may be some others).
"The Runtime System" section in this book is very useful. It provides details about compiler implementation, memory management, linkage with foreign code, language cost intuition. The latter I consider very important, because many functional programming books cover concepts without saying how expensive they are in terms of memory and time. Highly recommend this book, especially when there is a free online version.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With