[ contents | mbh ]

General Notes

First of all, everyone should have access to the Ocaml distribution. If you do not, go to www.ocaml.org and download it for your respective platform. When it is installed, you should read the instructions for the main components. Throughout this document, there are many snippets of code, such as:

	Printf.printf "Hello world!"
If you would like to run this code, there are two ways to do it: first, you can copy+paste the snippet into a top-level, and follow it with a double semicolon. Alternatively, you could copy it into a file, and precede it with "let somevar = ", compile it, and run it:
	(* File snip.ml, which is compiled by "ocamlc -o snip snip.ml" *)
	        let a = Printf.printf "Hello world!"

Two things to note here: first, this assigns the return value of the printf statement to the variable (or pattern, as you will later see) called 'a'. Many people prefer to use "let _ = Printf.printf "Hello world", which does the exact same thing as the snippet, but it causes the return value to be lost. (_ is like a 'filler' variable or pattern - if you set _ to anything, the value is essentially lost -- this is why _ is useful is splitting pairs)