type nombre = Entier of int | Flottant of float | Complexe of float * float ;; Entier 5;; Flottant 3.1;; Complexe (1.0, 3.4);; let addition = function | (Entier x, Entier y) -> Entier (x + y) | (Flottant x, Flottant y) -> Flottant (x +. y) | (Complexe (rx, ix), Complexe (ry, iy)) -> Complexe (rx +. ry, ix +. iy) | (Entier x, Flottant y) -> Flottant ((float x) +. y) | (Flottant x, Entier y) -> Flottant (x +. (float y)) | (Complexe (rx, ix), y) -> addition (y, Complexe (rx, ix)) | (Entier x, Complexe (ry, iy)) -> Complexe ((float x) +. ry, iy) | (Flottant x, Complexe (ry, iy)) -> Complexe ( x +. ry, iy);; addition (Flottant 3.4, Entier 5);; addition (Entier 5, Flottant 3.4);; addition (Complexe (3.0, 2.4), Flottant 3.4);;