WarningTutorial (draft)The factorial functionA recursive definition of a typeDocumentation and user's manualTable of contentsOCaml programs

A recursive definition of a type

   
  In Objective Caml, recursive definitions can be given not only to functions but also to types.

For instance evaluating this code

type int_bin_tree = Empty                                       (* basis *)
                  | Plant of int * int_bin_tree * int_bin_tree  (* induction *) 

defines a type whose values can be used to represent binary trees of integers.

   
  So, there exist recursive definitions of types and of functions as well.

Clearly, a type is a sets of values. Moreover a function can be considered as a set, too, that is, as the set of pairs (x,y) where y is the image of x under the function.

Thus the notion of a recursive definition, usually called an inductive definition, of a set is basic.


Latest update : October 5, 2006
This document was translated from LaTeX by Hyperlatex 2.5, which is not the latest version of Hyperlatex.

WarningTutorial (draft)The factorial functionA recursive definition of a typeDocumentation and user's manualTable of contentsOCaml programs