ocaml-programming

Simple OCaml programs
git clone git://git.laack.co/ocaml-programming.git
Log | Files | Refs | README

list_append.ml (338B)


      1 let rec append l1 l2 = match l1 with
      2     | [] -> l2
      3     | h :: t -> h :: append t l2
      4 
      5 let rec print_list xs = match xs with
      6     | [] -> ()
      7     | h :: xs' -> (print_int h); print_newline (); (print_list xs')
      8 
      9 let (l1 : int list) = [12340;2]
     10 let (l2 : int list) = [10;24;123;12340]
     11 let (l3 : int list) = append l1 l2
     12 let () = print_list l3