Are there learning materials for OCaml for those with no programming experience?

OCaml is a language with some advanced features, but a very gentle learning curve. It seems like it would be well-suited to teaching beginners to program (a few tricky error messages notwithstanding), but I haven’t seen many resources targeted at teaching programming from scratch. Does anyone here know any?

1 Like

There is OCaml from the Very Beginning written by @JohnWhitington.

6 Likes

An excellent (free) book is “LE LANGAGE CAML” https://caml.inria.fr/pub/distrib/books/llc.pdf.

Cheers,
Nicolás

1 Like

The lexer part is a bit dated, but except that, I absolutely love this book!

I guess that book hasn’t been translated to English. I don’t think my French is good enough to read a programming book…

I do not know the answer to your question, but I will bet that there are two people who have good answers:
(1) Matthias Felleisen, who has set up an entire program of teaching FP to high school students (and therefore teaching their teachers first).
(2) I remember that Therese Hardin taught caml-light and C (? Ada? C++? I forget) back in the mid-90s at CNAM (Centre National des Arts et Metiers) in Paris. To night-school students who were retooling from some other fieid.

I would bet that there’s some good experience and probably materials, from both of those folks.

There’s also CS3110 from Cornell University. Here’s the textbook. It’s pretty great!

I’m familiar with the Cornell book, which is great, but it seems like it’s for people who already have a basic knowledge of programming.

Before studying more complex books, it’s a good idea to first get an overview.

OCaml for the Skeptical / OCaml in a Nutshell : the title is funny; its main advantage is that it covers most OCaml concepts in 21 short sections where you can experiment by yourself on simple but essential things.

The books/courses already mentioned are nice. You can also consider this one that offers many examples/exercises and also a good overview: Developing Applications With Objective Caml.

LE LANGAGE CAML mentioned by @nojb is an excellent book. Written in Caml Light, it’s easy to turn it by yourself into OCaml. It offers a great chance to learn how to do a lot of things in pure Caml with only stdlib and a simple syntax extension system (use camlp5 (i.e. the “genuine camlp4”) that is fine for that. It works out of the box to deal with streams and it’s a chance to understand what is a LL(1)/recursive descent parser).

2 Likes