ZVON > References > Haskell reference
| Indexes | Syntax | >> Prelude << | Ratio | Complex | Numeric | Ix | Array | List | Maybe | Char | Monad | IO | Directory | System | Time | Locale | CPUTime | Random

Module: Prelude
Function: zipWith
Type: (a -> b -> c) -> [a] -> [b] -> [c]
Description: makes a list, its elements are calculated from the function and the elements of input lists occuring at the same position in both lists
Related: unzip, unzip3, zip, zip3, zipWith3

Example 1

Input: zipWith (+) [1,2,3] [3,2,1]

Output: [4,4,4]

Example 2

Input: zipWith (**) (replicate 10 5) [1..10]

Output: [5.0,25.0,125.0,625.0,3125.0,15625.0,78125.0,390625.1,1.95313e+06,9.76563e+06]

Example 3

Input: zipWith (\x y -> 2*x + y) [1..4] [5..8]

Output: [7,10,13,16]