let rec nth (a : int list) (i : int) : int = match a with
    | [] -> 0
    | x :: l -> if i = 0 then x else nth l (i-1)

let () = print_int (nth (0::1::2::3::4::5::6::7::8::9::[]) 3); print_newline ()
