let print_list fmt pr sep l =
  match l with
    []     -> ()
  | x :: r -> pr fmt x; List.iter (fun x -> Format.fprintf fmt "%s%a" sep pr x) r