let x = 3;; let y = 3;; x;; y;; "asd" ^ "qwe";; let s = "asd" ^ "qwe";; s.[4];; ['a'; 'b'];; let rec fib n = if n < 2 then 1 else fib (n - 1) + fib (n - 2);; fib 5;; #trace fib;; fib 5;; #untrace fib;; let rec sum n = if n <= 0 then 0 else n + sum (n - 1);; #trace sum;; sum 5;; let top_printer fmt l = Format.fprintf fmt "%d" (Lst.foldr1 (+) l);; #install_printer top_printer;; [3;4;5];; #uninstall_printer top_printer;; #remove_printer top_printer;; [3;4;5];; let p1 = (5, 1, "hello");; let p1 = (5, 1, ["hello"]);; let p1 = (5, 1, [of_list "hello"]);; let p1 = (5, 1, [Strng.of_list "hello"]);; let p1 = (5, 1, [Strng.of_string "hello"]);; let p2 = (5, 1, [Strng.of_string "world"]);; Picture.above p1 p2;; let rec foldr1 f = function | [] -> failwith "empty" | h :: t -> f h (foldr1 f t);; foldr1 (+) [];; foldr1 (+) [1;2;3];; let rec foldr1 f = function | [] -> failwith "empty" | [e] -> e | h :: t -> f h (foldr1 f t);; foldr1 (+) [1;2;3;4];; foldr1 (^) ["ab"; "cd"];; foldr1 (fun s1 s2 -> s1 ^ " " ^ s2) ["ab"; "cd"];; let rec zip_with f xs ys = match (xs, ys) with | ([], _) -> [] | (_, []) -> [] | (x :: xt, y :: yt) -> f x y :: zip_with f xt yt;; zip_with (+) [2;3;4] [5;6;7];; zip_with (+) [2;3;4] [5;6;7;6;7];; open Picture;; pixel;; pixel 'a';; let a = pixel 'a';; let b = pixel 'b';; beside a b;; row [to_string "qwe"];; row [of_string "qwe"];; row [of_strng "qwe"];; row [to_strng "qwe"];; row ['q'; 'e'; 'r'];; empty 3 3;; tile [[p00;p01;p02]; [p10;p11;p12]];; tile_with 1 1 [[p00;p01;p02]; [p10;p11;p12]];;