From 0800b1455b1f3b7b30b4f4ee14e908c5f61d91b0 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Thu, 11 Jun 2015 15:07:39 +0200 Subject: [PATCH] small compatibility mistake --- src/core/CCString.cppo.ml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/core/CCString.cppo.ml b/src/core/CCString.cppo.ml index 6a06e672..c41f04c0 100644 --- a/src/core/CCString.cppo.ml +++ b/src/core/CCString.cppo.ml @@ -306,13 +306,11 @@ let iter = String.iter #if OCAML_MAJOR >= 4 let map = String.map -let mapi = String.mapi let iteri = String.iteri #else let map f s = init (length s) (fun i -> f s.[i]) -let mapi f s = init (length s) (fun i -> f i s.[i]) let iteri f s = for i = 0 to String.length s - 1 do @@ -321,6 +319,16 @@ let iteri f s = #endif +#if OCAML_MAJOR >= 4 && OCAML_MINOR >= 2 + +let mapi = String.mapi + +#else + +let mapi f s = init (length s) (fun i -> f i s.[i]) + +#endif + let flat_map ?sep f s = let buf = Buffer.create (String.length s) in iteri