]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/components/extlib/hExtlib.ml
- transcript: patched to generate CoRN_notation.ma instead of CoRN.ma
[helm.git] / helm / software / components / extlib / hExtlib.ml
index 3cc6c9bb5c0bc876f74d35de8868f3231a56c14e..d4572789ad55f39795d000fd09192e839cfee02f 100644 (file)
@@ -153,6 +153,17 @@ let rec filter_map f =
       | None -> filter_map f tl
       | Some v -> v :: filter_map f tl)
 
+let list_rev_map_filter f l =
+   let rec aux a = function
+      | []       -> a
+      | hd :: tl -> 
+         begin match f hd with
+           | None   -> aux a tl
+           | Some b -> aux (b :: a) tl 
+         end
+   in 
+   aux [] l
+
 let list_concat ?(sep = []) =
   let rec aux acc =
     function
@@ -180,6 +191,11 @@ let split_nth n l =
     | n, hd :: tl -> aux (hd :: acc) (n - 1) tl in
   aux [] n l
 
+let list_last l =
+  let l = List.rev l in 
+  try List.hd l with exn -> raise (Failure "HExtlib.list_last")
+;;
+  
 (** {2 File predicates} *)
 
 let is_dir fname =