let nth t n = if n < 0 then None else let rec nth_aux t n = match t with | [] -> None | a :: t -> if n = 0 then Some a else nth_aux t (n-1) in nth_aux t n