let rec last = function
    [] -> raise Not_found
  | [ a ] -> a
  | a :: q -> last q