let array_map2i f x y = let c = min (Array.length x) (Array.length y) in Array.init c (fun i -> f i x.(i) y.(i))