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.
The zipWith3 function takes a function which combines three elements, as well as three lists and returns a list of the function applied to corresponding elements, analogous to zipWith. It is capable of list fusion, but it is restricted to its first list argument and its resulting list.
zipWith3 (,,) xs ys zs == zip3 xs ys zs
zipWith3 f [x1,x2,x3..] [y1,y2,y3..] [z1,z2,z3..] == [f x1 y1 z1, f x2 y2 z2, f x3 y3 z3..]

Examples

>>> zipWith3 (\x y z -> [x, y, z]) "123" "abc" "xyz"
["1ax","2by","3cz"]
>>> zipWith3 (\x y z -> (x * y) + z) [1, 2, 3] [4, 5, 6] [7, 8, 9]
[11,18,27]
The zipWith4 function takes a function which combines four elements, as well as four lists and returns a list of their point-wise combination, analogous to zipWith. It is capable of list fusion, but it is restricted to its first list argument and its resulting list.
The zipWith5 function takes a function which combines five elements, as well as five lists and returns a list of their point-wise combination, analogous to zipWith. It is capable of list fusion, but it is restricted to its first list argument and its resulting list.
The zipWith6 function takes a function which combines six elements, as well as six lists and returns a list of their point-wise combination, analogous to zipWith. It is capable of list fusion, but it is restricted to its first list argument and its resulting list.
The zipWith7 function takes a function which combines seven elements, as well as seven lists and returns a list of their point-wise combination, analogous to zipWith. It is capable of list fusion, but it is restricted to its first list argument and its resulting list.
The zipWithM function generalizes zipWith to arbitrary applicative functors.
zipWithM_ is the extension of zipWithM which ignores the final result.
When a key is found in both maps, apply a function to the key and values to produce an action and use its result in the merged map.
When a key is found in both maps, apply a function to the key and values and use the result in the merged map.
zipWithMatched
:: (Key -> x -> y -> z)
-> SimpleWhenMatched x y z
When a key is found in both maps, apply a function to the key and values, perform the resulting action, and maybe use the result in the merged map. This is the fundamental WhenMatched tactic.
When a key is found in both maps, apply a function to the key and values and maybe use the result in the merged map.
zipWithMaybeMatched
:: (Key -> x -> y -> Maybe z)
-> SimpleWhenMatched x y z
When a key is found in both maps, apply a function to the key and values and use the result in the merged map.
zipWithMatched :: (k -> x -> y -> z)
-> SimpleWhenMatched k x y z
When a key is found in both maps, apply a function to the key and values, perform the resulting action, and maybe use the result in the merged map. This is the fundamental WhenMatched tactic.
When a key is found in both maps, apply a function to the key and values and maybe use the result in the merged map.
zipWithMaybeMatched :: (k -> x -> y -> Maybe z)
-> SimpleWhenMatched k x y z
When a key is found in both maps, apply a function to the key and values to produce an action and use its result in the merged map.
When a key is found in both maps, apply a function to the key and values and use the result in the merged map.
zipWithMatched :: (k -> x -> y -> z)
-> SimpleWhenMatched k x y z
When a key is found in both maps, apply a function to the key and values, perform the resulting action, and maybe use the result in the merged map. This is the fundamental WhenMatched tactic.