Generic zip function?

Hello,
I was dealing with another Euler task and I ended up writing this:

  match List.zip cypher keys with
  | Ok x -> List.map x ~f:(fun (a,b) -> a lxor b)
  | _ -> []

Is there zip function that takes a function which is applied to the resulting tuple instead of producing a tuple? In this code I assume, I iterate twice over the list.

I assume Haskell has such function: [zip :: Zip f => f a → f b → f (a, b)]

Have you looked at List.map2 : ('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list?

Cheers,
Nicolas

2 Likes