mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 03:05:28 -05:00
small compatibility mistake
This commit is contained in:
parent
85cb18751a
commit
0800b1455b
1 changed files with 10 additions and 2 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue