let map2 f a b =
assert (Array.length a = Array.length b);
let l = Array.length a in
if l = 0 then [||] else begin
let r = Array.create l (f a.(0) b.(0)) in
for i = 1 to l - 1 do
Array.unsafe_set r i (f a.(i) b.(i))
done;
r
end