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: | foldl1 |
Type: | (a -> a -> a) -> [a] -> a |
Description: | it takes the first 2 items of the list and applies the function to them, then feeds the function with this result and the third argument and so on. See scanl1 for intermediate results. |
Related: | foldl, foldr, foldr1, scanl, scanl1, scanr, scanr1 |
Input: foldl1 (+) [1,2,3,4]
Output: 10
Input: foldl1 (/) [64,4,2,8]
Output: 1.0
Input: foldl1 (/) [12]
Output: 12.0
Input: foldl1 (&&) [1>2,3>2,5==5]
Output: False
Input: foldl1 max [3,6,12,4,55,11]
Output: 55
Input: foldl1 (\x y -> (x+y)/2) [3,5,10,5]
Output: 6.0