| h1::h2::tl when h1 = h2 -> list_uniq (h2 :: tl)
| h1::tl (* when h1 <> h2 *) -> h1 :: list_uniq tl
+let rec filter_map f =
+ function
+ | [] -> []
+ | hd :: tl ->
+ (match f hd with
+ | None -> filter_map f tl
+ | Some v -> v :: filter_map f tl)
+
(** {2 File predicates} *)
let is_dir fname =