This is List.mapi from the stdlib. RHEL 6 did not have this function.
---
mllib/common_utils.ml | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/mllib/common_utils.ml b/mllib/common_utils.ml
index 094ef10..3b15868 100644
--- a/mllib/common_utils.ml
+++ b/mllib/common_utils.ml
@@ -174,6 +174,14 @@ let iteri f xs =
in
loop 0 xs
+let rec mapi i f =
+ function
+ | [] -> []
+ | a::l ->
+ let r = f i a in
+ r :: mapi (i + 1) f l
+let mapi f l = mapi 0 f l
+
(* Timestamped progress messages, used for ordinary messages when not
* --quiet.
*)
--
1.8.5.3