# 4 + 1 ;; - : int = 5 # 4;; - : int = 4 # 1;; - : int = 1 # "Hello world";; - : string = "Hello world" # "Hello" ^ " world";; - : string = "Hello world" # 3.14;; - : float = 3.14 # false;; - : bool = false # true;; - : bool = true # 'a';; - : char = 'a' # 'ab';; Error: Syntax error # (1 + (2 + 3'' Error: Invalid literal 3'' # (1 + (2 + 3;; Error: Syntax error: ')' expected Line 1, characters 5-6: This '(' might be unmatched # 4 + "Hello";; Error: This expression has type string but an expression was expected of type int # 4 + 'Hello';; Error: Syntax error # 42 / 0;; Exception: Division_by_zero. # try 42 / 0 with Division_by_zero -> -1;; - : int = -1 # try 42 / 0 with e -> "Hello";; Error: This expression has type string but an expression was expected of type int # if true then 5 else "Hello";; Error: This expression has type string but an expression was expected of type int # if 5 > 0 then 5 else 0;; - : int = 5 # if 5 > 0 then true else false;; - : bool = true # 5 > 0;; - : bool = true # let five_gt_zero = 5 > 0;; val five_gt_zero : bool = true # five_gt_zero;; - : bool = true # x;; Error: Unbound value x # let x = 1 + 2 in x + 3;; - : int = 6 # x;; Error: Unbound value x # (let x = 1 + 2 in x + 3) + (let x = 4 + 5 in x + 6);; - : int = 21 # let x = 1 in (let x = 2 in x) + x;; - : int = 3 -- Stefan Muller Gladwin Development Chair Assistant Professor Computer Science Department Illinois Institute of Technology