aboutsummaryrefslogtreecommitdiff
path: root/clib
diff options
context:
space:
mode:
Diffstat (limited to 'clib')
-rw-r--r--clib/cArray.ml6
-rw-r--r--clib/cArray.mli4
-rw-r--r--clib/cString.ml7
-rw-r--r--clib/cString.mli4
-rw-r--r--clib/hashcons.ml4
5 files changed, 11 insertions, 14 deletions
diff --git a/clib/cArray.ml b/clib/cArray.ml
index d509c55b9a..b9dcfd61d1 100644
--- a/clib/cArray.ml
+++ b/clib/cArray.ml
@@ -63,6 +63,7 @@ sig
val fold_left_map : ('a -> 'b -> 'a * 'c) -> 'a -> 'b array -> 'a * 'c array
val fold_right_map : ('a -> 'c -> 'b * 'c) -> 'a array -> 'c -> 'b array * 'c
val fold_left2_map : ('a -> 'b -> 'c -> 'a * 'd) -> 'a -> 'b array -> 'c array -> 'a * 'd array
+ val fold_left2_map_i : (int -> 'a -> 'b -> 'c -> 'a * 'd) -> 'a -> 'b array -> 'c array -> 'a * 'd array
val fold_right2_map : ('a -> 'b -> 'c -> 'd * 'c) -> 'a array -> 'b array -> 'c -> 'd array * 'c
val fold_map : ('a -> 'b -> 'a * 'c) -> 'a -> 'b array -> 'a * 'c array
[@@ocaml.deprecated "Same as [fold_left_map]"]
@@ -451,6 +452,11 @@ let fold_left2_map f e v1 v2 =
let v' = map2 (fun x1 x2 -> let (e,y) = f !e' x1 x2 in e' := e; y) v1 v2 in
(!e',v')
+let fold_left2_map_i f e v1 v2 =
+ let e' = ref e in
+ let v' = map2_i (fun idx x1 x2 -> let (e,y) = f idx !e' x1 x2 in e' := e; y) v1 v2 in
+ (!e',v')
+
let distinct v =
let visited = Hashtbl.create 23 in
try
diff --git a/clib/cArray.mli b/clib/cArray.mli
index 5c7e09eeac..163191681a 100644
--- a/clib/cArray.mli
+++ b/clib/cArray.mli
@@ -114,6 +114,10 @@ sig
val fold_left2_map : ('a -> 'b -> 'c -> 'a * 'd) -> 'a -> 'b array -> 'c array -> 'a * 'd array
(** Same with two arrays, folding on the left; see also [Smart.fold_left2_map] *)
+ val fold_left2_map_i :
+ (int -> 'a -> 'b -> 'c -> 'a * 'd) -> 'a -> 'b array -> 'c array -> 'a * 'd array
+ (** Same than [fold_left2_map] but passing the index of the array *)
+
val fold_right2_map : ('a -> 'b -> 'c -> 'd * 'c) -> 'a array -> 'b array -> 'c -> 'd array * 'c
(** Same with two arrays, folding on the left *)
diff --git a/clib/cString.ml b/clib/cString.ml
index dd33562f16..b178cbbd2c 100644
--- a/clib/cString.ml
+++ b/clib/cString.ml
@@ -13,9 +13,6 @@ module type S = module type of String
module type ExtS =
sig
include S
- [@@@ocaml.warning "-3"] (* [@@noalloc] since 4.03.0 GPR#240 *)
- external equal : string -> string -> bool = "caml_string_equal" "noalloc"
- [@@@ocaml.warning "+3"]
val hash : string -> int
val is_empty : string -> bool
val explode : string -> string list
@@ -37,10 +34,6 @@ end
include String
-[@@@ocaml.warning "-3"] (* [@@noalloc] since 4.03.0 GPR#240 *)
-external equal : string -> string -> bool = "caml_string_equal" "noalloc"
-[@@@ocaml.warning "+3"]
-
let rec hash len s i accu =
if i = len then accu
else
diff --git a/clib/cString.mli b/clib/cString.mli
index 2000dfafb5..df25a3821a 100644
--- a/clib/cString.mli
+++ b/clib/cString.mli
@@ -16,10 +16,6 @@ sig
include S
(** We include the standard library *)
- [@@@ocaml.warning "-3"] (* [@@noalloc] since 4.03.0 GPR#240 *)
- external equal : string -> string -> bool = "caml_string_equal" "noalloc"
- [@@@ocaml.warning "+3"]
-
(** Equality on strings *)
val hash : string -> int
diff --git a/clib/hashcons.ml b/clib/hashcons.ml
index 39969ebf75..4e5d6212a0 100644
--- a/clib/hashcons.ml
+++ b/clib/hashcons.ml
@@ -131,9 +131,7 @@ module Hstring = Make(
type u = unit
let hashcons () s =(* incr accesstr;*) s
- [@@@ocaml.warning "-3"] (* [@@noalloc] since 4.03.0 GPR#240 *)
- external eq : string -> string -> bool = "caml_string_equal" "noalloc"
- [@@@ocaml.warning "+3"]
+ let eq = String.equal
(** Copy from CString *)
let rec hash len s i accu =