Objective Caml version 3.08.4 # "Every well-formed expression has a value and a type";; - : string = "Every well-formed expressions has a value and a type" # 1 + 2;; - : int = 3 # let v = 1 + 4;; val v : int = 5 # v;; - : int = 5 # let v = 7;; val v : int = 7 # let f x = x + 1;; val f : int -> int = # let g = f;; val g : int -> int = # g 2;; - : int = 3 # let f x y = x + y + 3;; val f : int -> int -> int = # let g = f 5;; val g : int -> int = # g 0;; - : int = 8 # g "";; This expression has type string but is here used with type int # let h x y = x + 1;; val h : int -> 'a -> int = # let h (x: int) (y: int) = x + 1;; val h : int -> int -> int = # let j x y = x +. y;; val j : float -> float -> float = # let id x = x;; val id : 'a -> 'a = # let twice f x = f (f x);; val twice : ('a -> 'a) -> 'a -> 'a = # let add1 x = x + 1;; val add1 : int -> int = # let add2 = twice add1;; val add2 : int -> int = # add2 3;; - : int = 5 # let square x = x * x;; val square : int -> int = # let power4 = twice square;; val power4 : int -> int = # power4 2;; - : int = 16 # fun x -> x * x;; - : int -> int = # let power4 = twice (fun x -> x * x);; val power4 : int -> int = # fun x y -> x * y;; - : int -> int -> int = # fun x -> fun y -> x * y;; - : int -> int -> int =