Plan of the Chapter
This chapter provides a comparison between the functional and
imperative models in the Objective CAML language, at the level both of
control structure and of the memory representation of values. The
mixture of these two styles allows new data structures to be created.
The first section studies this comparison by example. The second
section discusses the ingredients in the choice between composition of
functions and sequencing of instructions, and in the choice between
sharing and copying values. The third section brings out the interest of mixing these two styles to create mutable functional data, thus permitting data to be constructed without being
completely evaluated. The fourth section describes streams,
potentially infinite sequences of data, and their integration into the language via pattern-matching.