1/0;; 2;; 1/0;; List.hd [];; exception Int_exception of int;; Failure "hey";; raise (Failure "hey");; Failure "hey";; raise (Failure "hey");; Failure "hey";; raise (Failure "hey");; Failure "hey";; 5;; raise Failure "hey";; raise (Failure "hey");; raise Failure;; List.hd [];; try 1/0 with Division_by_zero -> 0 | Int_exception s -> s | Failure s -> s;; try 1/0 with Division_by_zero -> 0 | Int_exception s -> 1 | Failure s -> 2;; raise Int_exception 5;; raise (Int_exception 5);; List.hd [];; try List.hd [] with Division_by_zero -> 0 | Int_exception s -> 1 | Failure s -> 2;; raise Int_exception(3);; raise (Int_exception 3);; print_string("a\\n");; print_string("a\\n");5;; [1;2;3];; [|1;2;3|];; [|1;2;3;4|].(3);; let a = [|1;2;3;4|];; a.(3);; a.(3) <- 0;; a;; let swap v i j = let temp = v.(i) in v.(i) <- v.(j) ; v.(j) <- temp;; a;; swap a 1 2;; a;; let swap v i j = let temp = v.(i) in (v.(i) <- v.(j) ; v.(j) <- temp);; a.(3) <- 0;; type point = {x:float; y:float};; let move = fun ((dx, dy), p) -> (p.x <- p.x +. dx ; p.y <- p.y +. dy );; type mpoint = {mutable x:float; mutable y:float};; let move = fun ((dx, dy), p) -> (p.x <- p.x +. dx ; p.y <- p.y +. dy );; p = (1., 1.);; let p = (1., 1.);; let p = {x=1.; y=1.};; move ((2., 3.), p);; p;; let mp1 = {x=1.0; y=2.0};; let mp2 = {x=1.0; y=2.0};; mp1=mp2;; mp1==mp2;; let mp3 = mp1;; mp1 == mp3;; move((1., 1.), mp1);; mp1;; mp3;; let c = 0;; let c = ref 0;; !c;; let l = [ref 1; ref 2; ref 3];; List.hd(l);; !(List.hd(l);;) !(List.hd(l));; let ll = ref [1;2;3];; !ll;; let c = ref 0;; c := 5;; c ;; !c;; a = ref 0;; let a = ref 0;; let b = ref 0;; a == b;; let b = 5;; b := 4;; let gensym = let counter = ref 0 in fun () -> counter := !counter + 1; "sym"^(string_of_int !counter);; gensym();; let gensym = let counter = ref 0 in fun () -> counter := !counter + 1; "sym"^(string_of_int !counter);; gensym();; module ListStack : LIST_STACK = struct\n let empty = []\n\n let is_empty = function [] -> true | _ -> false\n\n let push x s = x :: s\n\n exception Empty\n\n let peek = function\n | [] -> raise Empty\n | x :: _ -> x\n\n let pop = function\n | [] -> raise Empty\n | _ :: s -> s\n\n let internal = function | [] -> [] | _ -> [];;\nend;; module type LIST_STACK = sig\n (** [Empty] is raised when an operation cannot be applied\n to an empty stack. *)\n exception Empty\n\n (** [empty] is the empty stack. *)\n val empty : 'a list\n\n (** [is_empty s] is whether [s] is empty. *)\n val is_empty : 'a list -> bool\n\n (** [push x s] pushes [x] onto the top of [s]. *)\n val push : 'a -> 'a list -> 'a list\n\n (** [peek s] is the top element of [s].\n Raises [Empty] if [s] is empty. *)\n val peek : 'a list -> 'a\n\n (** [pop s] is all but the top element of [s].\n Raises [Empty] if [s] is empty. *)\n val pop : 'a list -> 'a list\nend;; module ListStack : LIST_STACK = struct\n let empty = []\n\n let is_empty = function [] -> true | _ -> false\n\n let push x s = x :: s\n\n exception Empty\n\n let peek = function\n | [] -> raise Empty\n | x :: _ -> x\n\n let pop = function\n | [] -> raise Empty\n | _ :: s -> s\n\n let internal = function | [] -> [] | _ -> [];;\nend;; ListStack.push 1 empty;; ListStack.push 1 ListStack.empty;; exit\n;;