(2+2, 7>8);; (9-3,"ab"^"cd",(2+2 ,7>8));; [];; [1;2;3];; [1+1;2+2;3+3;4+4];; ["a";"b";"c"^"d"];; [[1];[2;3];[4;5;6]];; [1;"pq"];; 1::[];; 1::[2];; "a"::["b";"c"];; 1::["b";"cd"];; [1;2]@[3;4;5];; ["a"]@["b"];; []@[1];; 1@[2;3];; [1]@["a";"b"];; let x = 2 + 2;; let y = x * x * x;; let z = [x;y;x+y];; let p = a + 1;; let y = let tempVar = x + (2 * y) in tempVar * tempVar ;; tempVar;; let (x,y,z) = (2+3,"a"^"b", 1::[2]);; let h::t = [1;2;3];; let l = [1;2;3];; let h::t = l;; let rec sort l = match l with [] -> [] | (h::t) -> let (l,r) = partition ((<) h) t in (sort l)@(h::(sort r)) ;; sort list1;; sort ["p";"a";"z";"q";"r";"b"];; type myrec = {name : string; age : int; pass : bool};; let r = {name="ranjit"; age=27; pass=false};; r.age ;; r.name ;; r.pass ;; r.grade ;; hd [1;2;3;4;5]; tl [1;2;3;4;5]; hd ["a";"b";"cd"]; tl ["a";"b";"cd"]; hd [(1,"a");(7,"c")]; tl [(1,"a");(7,"c")]; hd [[];[1;2;3];[4;5]]; tl [[];[1;2;3];[4;5]]; (hd [[];[1;2;3]]) = (hd [[];["abc"]]); hd [[];[1;2;3]]; hd [[];["abc"]]; if (1 < 2) then ["ab";"cd"] else ["x"]; let x = 1 ;; let y = 2 ;; if ( x < y) then if (x + y > 10) then [x] else [y] else [];; if (1 < 2) then [1;2] else 5; if false then [1;2] else 5; (if (1 > 2) then 0 else 1) + (if (x =y) then 10 else 11); (if (1 > 2) then 0 else 1)::[]; (* but be careful *) if 1>2 then [1;2] else [] ;; if 1<2 then [] else ["a"];; (* and so ... *) (if 1>2 then [1;2] else []) = (if 1<2 then [] else ["a"]) ;; (* LEC 2 END *)