let x = 1 ;;
let y = 2 ;;
let y = x+1 ;;
y ;;
let x = 10 ;;
y ;;
let a = 2 and b = a+1 ;;
let x = 4 in x * x ;;
let a = 2 in a + 1 ;;
let term1 = 10 and term2 = 0 in term1 * term2;;
let a = 1 in let b = a+1 in let c = a+b in let d = a+b+c in d ;;
let a = 10 and b = 3 and c = 5 ;; (* we need to define three identifiers a, b and c for the next expression *)
let discriminant = b*b - 4*a*c in
if discriminant > 0 then 2
else if discriminant = 0 then 1
else 0 ;;
let e = let prod = 4*3*2 in prod*prod+prod+2 ;;
fun x -> x ;;
fun a ->
if a < 0 then -a
else a;;
function a ->
if a < 0 then -a
else a ;;
fun (a:int) ->
if a < 0 then -a
else a ;;
let identity = function x -> x ;;
let identity = fun x -> x ;;
let identity = function (x:int) -> x ;;
let identity = fun (x:int) -> x ;;
let identity x = x ;;
let identity (x:int):int = x ;;
let identity (x:'a):'a = x ;;
let is_zero (x:int): bool = x=0 ;;
let successor (x:int):int = x+1 ;;
let surface (length:float) (width:float):float = length *.width ;;
let surface_circle (radius:float):float =
let pi = 3.14 in pi *. (radius**2.);;
identity x ;;
identity (x) ;;
(fun (x:int) -> x+1) 3 ;;
surface_circle 9.76 ;;
let successor2 (x:int):int=x+1 in successor2 10 ;;
successor2 19 ;;
let discriminant (a : int) (b : int) (c : int):int = b * b - 4 * a * c ;;
discriminant 2 3 4 ;;