]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/ocaml/extlib/hExtlib.ml
ported to new syntactic requirement about terms being surrounded by parens
[helm.git] / helm / ocaml / extlib / hExtlib.ml
index 31cf86a75d4007d6a570fbee91418cd22330f8aa..9f4f2d9c904bef51d1c3121eeeec90aad4ca050e 100644 (file)
@@ -57,6 +57,7 @@ let profile =
 (** {2 Optional values} *)
 
 let map_option f = function None -> None | Some v -> Some (f v)
+let iter_option f = function None -> () | Some v -> f v
 let unopt = function None -> failwith "unopt: None" | Some v -> v
 
 (** {2 String processing} *)
@@ -104,6 +105,15 @@ let rec filter_map f =
       | None -> filter_map f tl
       | Some v -> v :: filter_map f tl)
 
+let list_concat ?(sep = []) =
+  let rec aux acc =
+    function
+    | [] -> []
+    | [ last ] -> List.flatten (List.rev (last :: acc))
+    | hd :: tl -> aux ([sep; hd] @ acc) tl
+  in
+  aux []
+
 (** {2 File predicates} *)
 
 let is_dir fname =