Advanced Data Types
In this section, we study some OCaml data types that are unlikely to be as familiar from other languages. For that reason, we call them advanced. They include:
- options, which are loosely related to
null
in Java; - association lists, which are an amazingly simple implementation of maps (aka dictionaries) based on lists and tuples;
- algebraic data types, which are arguably the most important kind of type in OCaml, and indeed are the power behind many of the other built-in types; and
- exceptions, which are a special kind of algebraic data type.