mirror of
https://github.com/c-cube/sidekick.git
synced 2025-12-10 13:14:09 -05:00
add IArray.iteri2
This commit is contained in:
parent
252f7243a4
commit
e979b88148
2 changed files with 8 additions and 0 deletions
|
|
@ -165,6 +165,12 @@ let iter2 f a b =
|
|||
f (unsafe_get a i) (unsafe_get b i)
|
||||
done
|
||||
|
||||
let iteri2 f a b =
|
||||
if length a <> length b then invalid_arg "iteri2";
|
||||
for i = 0 to length a-1 do
|
||||
f i (unsafe_get a i) (unsafe_get b i)
|
||||
done
|
||||
|
||||
let fold2 f acc a b =
|
||||
if length a <> length b then invalid_arg "fold2";
|
||||
let rec aux acc i =
|
||||
|
|
|
|||
|
|
@ -106,5 +106,7 @@ val map2 : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t
|
|||
|
||||
val fold2 : ('acc -> 'a -> 'b -> 'acc) -> 'acc -> 'a t -> 'b t -> 'acc
|
||||
|
||||
val iteri2 : (int -> 'a -> 'b -> unit) -> 'a t -> 'b t -> unit
|
||||
|
||||
val iter2 : ('a -> 'b -> unit) -> 'a t -> 'b t -> unit
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue