[Pkg-libvirt-commits] [libguestfs] 23/66: mllib: utils: Add mapi function.
Hilko Bengen
bengen at moszumanska.debian.org
Fri May 9 12:56:21 UTC 2014
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to branch master
in repository libguestfs.
commit dc24a9b5fbe70546c47916a800fbd0c7f47cb5f4
Author: Richard W.M. Jones <rjones at redhat.com>
Date: Thu Apr 3 12:23:37 2014 +0100
mllib: utils: Add mapi function.
This is List.mapi from the stdlib. RHEL 6 did not have this function.
(cherry picked from commit 55437e459b80f3805925d42c5ab6ae0f63386360)
---
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.
*)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git
More information about the Pkg-libvirt-commits
mailing list