]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/components/extlib/hExtlib.ml
new function list_mapi_acc
[helm.git] / helm / software / components / extlib / hExtlib.ml
index 8451eb6b86c69eb435adf561a7290497cc353ff3..49d28bbb91733a50e785d3c17388a58cb7c7b32a 100644 (file)
@@ -148,6 +148,14 @@ let list_mapi f l =
      aux 0 l
 ;;
 
+let list_mapi_acc f a l =
+  let rec aux k a res = function
+    | [] -> a, List.rev res
+    | h::tl -> let a,h = f h k a in aux (k+1) a (h::res) tl
+  in
+   aux 0 a [] l
+;;
+
 let list_index p =
  let rec aux n =
   function