File tree Expand file tree Collapse file tree 3 files changed +9
-0
lines changed Expand file tree Collapse file tree 3 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ let get_safe a i =
44
44
None
45
45
46
46
let map_inplace f a = Array. iteri (fun i e -> Array. unsafe_set a i (f e)) a
47
+ let mapi_inplace f a = Array. iteri (fun i e -> Array. unsafe_set a i (f i e)) a
47
48
let fold = Array. fold_left
48
49
49
50
let foldi f acc a =
Original file line number Diff line number Diff line change @@ -64,6 +64,10 @@ val map_inplace : ('a -> 'a) -> 'a t -> unit
64
64
(* * [map_inplace f a] replace all elements of [a] by its image by [f].
65
65
@since 3.8 *)
66
66
67
+ val mapi_inplace : (int -> 'a -> 'a ) -> 'a t -> unit
68
+ (* * [mapi_inplace f a] replace all elements of [a] by its image by [f].
69
+ @since NEXT_RELEASE *)
70
+
67
71
val fold : ('a -> 'b -> 'a ) -> 'a -> 'b t -> 'a
68
72
(* * [fold f init a] computes [f (… (f (f init a.(0)) a.(1)) …) a.(n-1)],
69
73
where [n] is the length of the array [a].
Original file line number Diff line number Diff line change @@ -62,6 +62,10 @@ val map_inplace : f:('a -> 'a) -> 'a t -> unit
62
62
(* * [map_inplace ~f a] replace all elements of [a] by its image by [f].
63
63
@since 3.8 *)
64
64
65
+ val mapi_inplace : f :(int -> 'a -> 'a ) -> 'a t -> unit
66
+ (* * [mapi_inplace ~f a] replace all elements of [a] by its image by [f].
67
+ @since NEXT_RELEASE *)
68
+
65
69
val fold : f :('a -> 'b -> 'a ) -> init :'a -> 'b t -> 'a
66
70
(* * [fold ~f ~init a] computes [f (… (f (f init a.(0)) a.(1)) …) a.(n-1)],
67
71
where [n] is the length of the array [a].
You can’t perform that action at this time.
0 commit comments