ZVON > References > Haskell reference |
Intro / Search / ZVON |
| Indexes | Syntax | >> Prelude << | Ratio | Complex | Numeric | Ix | Array | List | Maybe | Char | Monad | IO | Directory | System | Time | Locale | CPUTime | Random |
Module: | Prelude |
---|---|
Function: | foldl |
Type: | (a -> b -> a) -> a -> [b] -> a |
Description: | it takes the second argument and the first item of the list and applies the function to them, then feeds the function with this result and the second argument and so on. See scanl for intermediate results. |
Related: | foldl1, foldr, foldr1, scanl, scanl1, scanr, scanr1 |
Input: foldl (/) 64 [4,2,4]
Output: 2.0
Input: foldl (/) 3 []
Output: 3.0
Input: foldl max 5 [1,2,3,4]
Output: 5
Input: foldl max 5 [1,2,3,4,5,6,7]
Output: 7
Input: foldl (\x y -> 2*x + y) 4 [1,2,3]
Output: 43