(* ---------- ex01 ---------- *) 1 + 5 ;; let x = 1 ;; let y = x*2 + 1 ;; (* ---------- ex02 ---------- *) print_string "Hello World!" ;; print_int (10 + 3) ;; print_char 'c' ;; print_float 1.0 ;; (* ---------- ex05 ---------- *) let f x = x + 1 ;; f 2 ;; fun x -> x + 1 ;; (fun x-> x + 1) 2 ;; (* ---------- ex06 ---------- *) let rec fact x = if x = 0 then 1 else x * fact (x-1) ;; fact 5 ;; (* ---------- ex07 ---------- *) let f x = x + x ;; f 3 ;; let a x = x +. x ;; a 3.0 ;; let s x = x ^ x ;; s "lol" ;; let d (x,y) = x + y ;; d (2,4) ;; let g (x,y) = x +. y ;; g (2.0,4.0) ;; let h (x,y) = (y, x) ;; h (3,9) ;; let j (x,y) = x = y ;; j (2,2) ;; j (2,3) ;; let k x y = x + y ;; k 2 4 ;; (* ---------- ex08 ---------- *) let rec mdc (m,n) = if (n = 0) then m else mdc (n,(m mod n)) ;; mdc (9,3) ;; mdc (9,4) ;;