diff --git a/hw1.ml b/hw1.ml new file mode 100644 index 0000000..d979684 --- /dev/null +++ b/hw1.ml @@ -0,0 +1,19 @@ + +let rec merge (l1,l2) = + match (l1,l2) with + | ([], _) -> l2 + | (_, []) -> l1 + | (h1::t1, h2::t2) -> h1::h2::merge(t1,t2) + + + +let rec printer msg = + match msg with + | [] -> () + | h::t -> + print_int h; + printer t + +let greeter = merge([1;2;3],[4;5;6]) + +let _ = printer greeter diff --git a/test.ml b/test.ml index 2f194f7..2fc16e4 100644 --- a/test.ml +++ b/test.ml @@ -1,3 +1,33 @@ + +let _ = print_int 13 + +let rec merge2 l1 l2 = + match (l1,l2) with + | ([], _) -> l2 + | (_, []) -> l1 + | (h1::t1, h2::t2) -> + if h1