let print_list oc string_of_ele l =
  List.iter (fun ele -> Printf.fprintf oc "%s\n" (string_of_ele ele)) l