Introduction to Ocaml

Ocaml is installed on the CS machines at /l/ocaml. There are several ways to run Ocaml: the simplest is to write your definitions in a single file and invoke the top-level read-eval-print loop. As we move along and our programs get larger, we will use modules spread over several files and use the separate compilation and linking facilities. For now, if your definitions are in a file like test.ml, then you can load and evaluate the definitions as follows:
> /l/ocaml/bin/ocaml 
        Objective Caml version 3.06

# #use "test.ml";;
val fact : int -> int = 
# fact 5;;
- : int = 120
# exit 0;;

Assignment