hn-classics/_stories/2006/9633960.md

173 lines
9.3 KiB
Markdown

---
created_at: '2015-05-31T12:35:38.000Z'
title: OCaml Resources (2006)
url: http://www2.lib.uchicago.edu/keith/ocaml-class/home.html
author: laex
points: 85
story_text:
comment_text:
num_comments: 72
story_id:
story_title:
story_url:
parent_id:
created_at_i: 1433075738
_tags:
- story
- author_laex
- story_9633960
objectID: '9633960'
year: 2006
---
[Source](http://www2.lib.uchicago.edu/keith/ocaml-class/home.html "Permalink to OCaml for the Skeptical")
# OCaml for the Skeptical
![][1] OCaml for the Skeptical
[Keith Waclena][2]
[The University of Chicago Library DLDC][3]
## OCaml for the Skeptical
[Course Materials][4]
## 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][5] at the University of Edinburgh[1][6] 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][7].
Development of ML proceeded at Edinburgh, Stanford and AT&T Bell Labs; at the [Institut National de Recherche en Informatique et en Automatique (INRIA)][8] 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][9], [MLton ][10], [Moscow ML][11] [3][12], etc). Lazy ML strongly influenced Haskell and is no longer actively developed. Caml development continues at INRIA.
A [Brief History of Caml][13] 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):
* _Caml_: the original French implementation; no longer developed.
* _Caml Light_ (and later _Caml Special Light_): the precursors to OCaml; practically the same as OCaml except for the object system that gives OCaml its "O"; still available, quite stable and still supported I think (latest release was in 2002), but I don't know why you would choose it over OCaml.
* _Objective Caml_ or _OCaml_: the latest and greatest version of the language, introduced the first strongly-typed object system with type inference.
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][14].
## Third Party Software
The best one-stop-shopping site for third party OCaml libraries is [The Caml Humps][15] (newbies should go directly to the [Caml Light / OCaml Hump][16]).
## OCaml Documentation
### Official Documentation
[OCaml User's Manual][17], incorporating:
* [an introduction][18]
* [the language proper][19]
* [the core library][20]
* [the standard library][21] (mostly data structures)
and much more.
### OCaml Books
Besides these books in English, there are eleven in French, and one each in German and Italian.
* [**Developing Applications With Objective Caml**][22], Emmanuel Chailloux, Pascal Manoury and Bruno Pagano, preliminary translation of the book [ _Dveloppement d'applications avec Objective Caml_][23].
> This book is very good and typically O'Reillian; I highly recommend it.
* [ _The Functional Approach to Programming_][24], Guy Cousineau and Michel Mauny, Cambridge University Press, Cambridge, 1998, ISBN 0-521-57183-9 (hardcover), 0-521-57681-4 (paperback)
> This book is a little more formal; most would probably consider it rather dry. Note that it covers the earlier language Caml rather than OCaml and so has no coverage of OCaml's object system nor the module system. But all the stuff about functional programming and types and syntax is applicable to OCaml.
* [_The Little MLer_][25], Matthias Felleisen and Daniel P. Friedman, The MIT Press, Cambridge MA, 1997, ISBN 0-262-56114-X
> Like the other _Little_ books by the same authors (_Lisper_, _Schemer_, _Java_), this is not a conventional introduction to ML. It's a programmed text with a sense of humor that will either enlighten you or infuriate you. It assumes no previous familiarity with ML but covers very advanced topics very quickly. It is almost completely concerned with types. (N.B. while this is a book about Standard ML, it works fine for OCaml and the authors provide a one-page cheat sheet that explains how to translate the book's ML code into OCaml.)
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.
* [ A Concise Introduction to Objective Caml][26] by David Matuszek.
> A long single web page; worth reading.
* Jason Hickey's [ Introduction to Objective Caml][27] as used in his [ compiler design course at Caltech][28].
> 110-page well-hyperlinked PDF, very well done.
* [ Learning OCaml, for C, C++, Perl and Java programmers][29] by Richard W.M. Jones.
> Substantial group of web pages; gets into some fairly advanced stuff quickly; covers some stuff that most tutorials don't (keyword and optional parameters, OCaml's Gtk bindings (Gtk is the popular, modern GUI toolkit used by the Gimp and the Gnome project), garbage collection, a great discussion of weak pointers, speed, etc); and frequently explains what's going on internally in the compiler and interpreter.
* [Kitt's OCaml Webpage][30]. A nice 10-page introduction.
> Kind of like a very long reference card.
### OCaml Mailing Lists and Newsgroups
The official [ OCaml mailing list][31] ([archives][32]) can also be [read with your favorite news reader][33] (which I highly recommend) thanks to [the amazing gmane][34] or directly [via your browser][35].
There's also a list [specifically for beginners][36] (also available [via gmane][37]).
OCaml is also discussed on Usenet in [comp.lang.ml][38] (which also covers Standard ML) and [comp.lang.functional][39] (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!
This page was last updated on 17 June 2006.
[1]: http://caml.inria.fr/pub/logos/caml.80x30.gif
[2]: http://www2.lib.uchicago.edu/keith/
[3]: http://www2.lib.uchicago.edu/staffweb/depts/dldc/
[4]: http://www2.lib.uchicago.edu/class-01.html
[5]: http://en.wikipedia.org/wiki/LCF_theorem_prover
[6]: http://www2.lib.uchicago.edu#note1
[7]: http://www2.lib.uchicago.edu#note2
[8]: http://www.inria.fr/
[9]: http://www.smlnj.org/
[10]: http://www.mlton.org/
[11]: http://www.dina.kvl.dk/~sestoft/mosml.html
[12]: http://www2.lib.uchicago.edu#note3
[13]: http://www.pps.jussieu.fr/~cousinea/Caml/caml_history.html
[14]: http://www2.lib.uchicago.edu/installing.html
[15]: http://caml.inria.fr/humps/index.html
[16]: http://caml.inria.fr/humps/caml_latest.html
[17]: http://caml.inria.fr/pub/docs/manual-ocaml/
[18]: http://caml.inria.fr/pub/docs/manual-ocaml/manual003.html
[19]: http://caml.inria.fr/pub/docs/manual-ocaml/manual008.html
[20]: http://caml.inria.fr/pub/docs/manual-ocaml/manual033.html
[21]: http://caml.inria.fr/pub/docs/manual-ocaml/manual034.html
[22]: http://caml.inria.fr/oreilly-book/
[23]: http://caml.inria.fr/books-eng.html#ocaml-oreilly
[24]: http://caml.inria.fr/books-eng.html#cousineau-mauny
[25]: http://mitpress.mit.edu/catalog/item/default.asp?ttype=2&tid=4787
[26]: http://www.csc.villanova.edu/~dmatusze/resources/ocaml/ocaml.html
[27]: http://www.cs.caltech.edu/courses/cs134/cs134b/book.pdf
[28]: http://www.cs.caltech.edu/courses/cs134/cs134b/
[29]: http://www.ocaml-tutorial.org/
[30]: http://www.cs.ait.ac.th/~kitt/caml/
[31]: mailto:caml-list-request%40inria.fr
[32]: http://caml.inria.fr/pub/ml-archives/caml-list/
[33]: news:news.gmane.org
[34]: http://www.gmane.org/
[35]: http://news.gmane.org/gmane.comp.lang.caml.inria/
[36]: http://groups.yahoo.com/group/ocaml_beginners/
[37]: http://news.gmane.org/gmane.comp.lang.ocaml.beginners/
[38]: news:comp.lang.ml
[39]: news:comp.lang.functional