zipWith

zipWith generalises zip by zipping with the function given as the first argument, instead of a tupling function.
zipWith (,) xs ys == zip xs ys
zipWith f [x1,x2,x3..] [y1,y2,y3..] == [f x1 y1, f x2 y2, f x3 y3..]
zipWith is right-lazy:
>>> let f = undefined

>>> zipWith f [] undefined
[]
zipWith is capable of list fusion, but it is restricted to its first list argument and its resulting list.

Examples

zipWith (+) can be applied to two lists to produce the list of corresponding sums:
>>> zipWith (+) [1, 2, 3] [4, 5, 6]
[5,7,9]
>>> zipWith (++) ["hello ", "foo"] ["world!", "bar"]
["hello world!","foobar"]
The zipWith function generalizes zip. Rather than tupling the elements, the elements are combined using the function passed as the first argument.
zipWith generalises zip by zipping with the function given as the first argument, instead of a tupling function. For example, zipWith (+) is applied to two ByteStrings to produce the list of corresponding sums.
zipWith generalises zip by zipping with the function given as the first argument, instead of a tupling function. For example, zipWith (+) is applied to two ByteStrings to produce the list of corresponding sums.
O(n) zipWith generalises zip by zipping with the function given as the first argument, instead of a tupling function. Performs replacement on invalid scalar values.
zipWith generalises zip by zipping with the function given as the first argument, instead of a tupling function. Properties
unstream (zipWith f (stream t1) (stream t2)) = zipWith f t1 t2
zipWith generalizes zip by zipping with the function given as the first argument, instead of a tupling function. For example, zipWith (+) is applied to two sequences to take the sequence of corresponding sums.
zipWith generalises zip by zipping with the function given as the first argument, instead of a tupling function.
zipWith (,) xs ys == zip xs ys
zipWith f [x1,x2,x3..] [y1,y2,y3..] == [f x1 y1, f x2 y2, f x3 y3..]
For example, zipWith (+) is applied to two lists to produce the list of corresponding sums:
>>> zipWith (+) [1, 2, 3] [4, 5, 6]
[5,7,9]
zipWith is right-lazy:
>>> let f = undefined

>>> zipWith f [] undefined
[]
zipWith is capable of list fusion, but it is restricted to its first list argument and its resulting list.
Zip two Producers using the provided combining function
Combines two input streams using the supplied function. Continues yielding elements from both input streams until one of them finishes.
Zip two Streams using the provided combining function
zipWith generalises zip by zipping with the function given as the first argument, instead of a tupling function. For example, zipWith (+) is applied to two lists to produce the list of corresponding sums:
>>> zipWith (+) [1, 2, 3] [4, 5, 6]
[5,7,9]
zipWith is right-lazy:
zipWith f [] _|_ = []
zipWith is capable of list fusion, but it is restricted to its first list argument and its resulting list.
O(min(m,n)) Zip two vectors with the given function.
O(min(m,n)) Zip two vectors with the given function.
O(min(m,n)) Zip two vectors with the given function.
O(min(m,n)) Zip two vectors with the given function.
Combine two arrays, element-wise, with a binary operator. If the extent of the two array arguments differ, then the resulting array's extent is their intersection.
Takes two lists and combines them with a custom combining function
This is an example for application specific handling of result values. Assume you obtain two lazy lists say from readFile and you want to zip their contents. If one of the stream readers emits an exception, we quit with that exception. If both streams have throw an exception at the same file position, the exception of the first stream is propagated.
O(n) zipWith generalises zip by zipping with the function given as the first argument, instead of a tupling function. Performs replacement on invalid scalar values.