small compatibility mistake

This commit is contained in:
Simon Cruanes 2015-06-11 15:07:39 +02:00
parent 85cb18751a
commit 0800b1455b

View file

@ -306,13 +306,11 @@ let iter = String.iter
#if OCAML_MAJOR >= 4 #if OCAML_MAJOR >= 4
let map = String.map let map = String.map
let mapi = String.mapi
let iteri = String.iteri let iteri = String.iteri
#else #else
let map f s = init (length s) (fun i -> f s.[i]) 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 = let iteri f s =
for i = 0 to String.length s - 1 do for i = 0 to String.length s - 1 do
@ -321,6 +319,16 @@ let iteri f s =
#endif #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 flat_map ?sep f s =
let buf = Buffer.create (String.length s) in let buf = Buffer.create (String.length s) in
iteri iteri