OCaml for the Skeptical
Keith Waclena
The University of Chicago Library DLDC

OCaml for the Skeptical

Course Materials

Some History

Which ML?

OCaml is a dialect of ML (for Meta Language), which started out as a language for mathematical theorem proving in the LCF project at the University of Edinburgh1 and which is descended from Algol and Lisp via P.J. Landin's never-implemented language ISWIM ("If you See What I Mean" -- which was very influential due to several important journal articles in the late 1960's)2.

Development of ML proceeded at Edinburgh, Stanford and AT&T Bell Labs; at the Institut National de Recherche en Informatique et en Automatique (INRIA) in France as Caml (for Categorical Abstract Machine Language, after the underlying compilation technique); and at Chalmers in Sweden (as Lazy ML). The original line eventually became Standard ML, which has several notable implementations (Standard ML of New Jersey, MLton , Moscow ML 3, etc). Lazy ML strongly influenced Haskell and is no longer actively developed. Caml development continues at INRIA.

A Brief History of Caml by Guy Cousineau, the original developer, provides some insights.

Which Caml?

There are three "Caml" languages (at least: the excellent Caml compilers are very popular with researchers all over the world as a basis for experimental languages):

In summary, make sure you install and use OCaml and don't bother with the earlier Camls!

Standard ML and OCaml have minor syntactic differences. If you know OCaml, you can switch to ML very easily. The most important differences are in the libraries of the languages and in two significant OCaml advances: the object system (Standard ML has none) and the module system (very similar in basic use, though).

Getting OCaml

OCaml is installed on merlot.lib and you can use it there. It's in the FreeBSD ports, the NetBSD packages, and Linux rpms are available (Debian, Mandrake and RedHat reportedly install OCaml). Binaries for Windows and Linux are available from INRIA and, of course, OCaml is free software so you can always download and install from source; it compiles and runs on most every version of Unix (MacOS X included). For more information see Installing OCaml.

Third Party Software

The best one-stop-shopping site for third party OCaml libraries is The Caml Humps (newbies should go directly to the Caml Light / OCaml Hump).

OCaml Documentation

Official Documentation

OCaml User's Manual, incorporating:

and much more.

OCaml Books

Besides these books in English, there are eleven in French, and one each in German and Italian.

Finally it should be mentioned that there are many books on Standard ML and all of these are quite usable by OCaml programmers, once you've gone through any of the books above (you do want to initially learn OCaml from an OCaml book, I think, but after that you can branch out into the literature of Standard ML).

OCaml Tutorials

I suggest doing these tutorials in this order, except for Kitt's, which, being so terse, is good to look at simultaneously with all of these.

OCaml Mailing Lists and Newsgroups

The official OCaml mailing list (archives) can also be read with your favorite news reader (which I highly recommend) thanks to the amazing gmane or directly via your browser.

There's also a list specifically for beginners (also available via gmane).

OCaml is also discussed on Usenet in comp.lang.ml (which also covers Standard ML) and comp.lang.functional (which covers all functional languages).

Footnotes

  1. Michael J. C. Gordon; Robin Milner; Christopher P. Wadsworth. Edinburgh LCF: A Mechanized Logic for Computation. New York: Springer Verlag, 1979.
  2. P. J. Landin. "The Next 700 Programming Languages" in Communications of the ACM. 9:3. March 1966. Pages 157-66.
  3. Moscow ML is actually implemented using the Caml Light compiler!