Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which English tutorial would you advise to learn OCaml? [closed]

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...

like image 557
Fabrice Le Fessant Avatar asked Feb 20 '12 09:02

Fabrice Le Fessant


People also ask

How hard is it to learn OCaml?

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.


7 Answers

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.

like image 126
gasche Avatar answered Oct 14 '22 03:10

gasche


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.

like image 45
barti_ddu Avatar answered Oct 14 '22 04:10

barti_ddu


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).

like image 39
ygrek Avatar answered Oct 14 '22 04:10

ygrek


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.

like image 43
Animesh Avatar answered Oct 14 '22 03:10

Animesh


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

like image 26
user1291037 Avatar answered Oct 14 '22 03:10

user1291037


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.

like image 23
mbunit Avatar answered Oct 14 '22 04:10

mbunit


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.

like image 37
Pavel Zaichenkov Avatar answered Oct 14 '22 03:10

Pavel Zaichenkov