Benefits of OCaml

Interactive top-level

The OCaml distribution provides an interactive top-level program that makes it easy to test snippets of code and, in particular, provides feedback on the types inferred by OCaml.

The interactive top-level is entered simply by executing the ocaml program:

$ ocaml
        Objective Caml version 3.08.3

#

Pieces of code and even whole programs can now be entered into the top-level # prompt and the names of definitions and their inferred types are displayed:

# let a = 2 + 3;;
val a : int = 5
#

Note that blocks of code are terminated with ;; in the top-level.