let fold_left2 f x a b = assert (Array.length a = Array.length b); let r = ref x in for i = 0 to Array.length a - 1 do r := f !r (Array.unsafe_get a i) (Array.unsafe_get b i) done; !r