Module Array.Smart
The functions defined in this module are optimized specializations of the main ones, when the returned array is of same type as one of the original array.
val map : ('a -> 'a) -> 'a array -> 'a array
Smart.map f a
behaves asmap f a
but returnsa
instead of a copy whenf x == x
for allx
ina
.
val map_i : (int -> 'a -> 'a) -> 'a array -> 'a array
val map2 : ('a -> 'b -> 'b) -> 'a array -> 'b array -> 'b array
Smart.map2 f a b
behaves asmap2 f a b
but returnsa
instead of a copy whenf x y == y
for allx
ina
andy
inb
pointwise.