This chapter presents the basic elements of the functional part of the
Objective CAML language, namely its syntactic elements, its language
of types and its exception mechanism. This will lead us to the development
of a first example of a complete program.
The first section describes the core of the language, beginning with
primitive values and the functions which manipulate them. We then go on to
structured values and to function values. The basic control structures are
introduced as well as local and global value declarations. The second
section deals with type definitions for the construction of structured
values and with pattern matching to access these structures. The third
section compares the inferred type of functions and their domain of
definition, which leads us to introduce the exception mechanism. The
fourth section illustrates all these notions put together, by describing a
simple application: a desktop calculator.