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: | foldr |
Type: | (a -> b -> b) -> b -> [a] -> b |
Description: | it takes the second argument and the last item of the list and applies the function, then it takes the penultimate item from the end and the result, and so on. See scanr for intermediate results. |
Related: | foldl, foldl1, foldr1, scanl, scanl1, scanr, scanr1 |
Input: foldr (+) 5 [1,2,3,4]
Output: 15
Input: foldr (/) 2 [8,12,24,4]
Output: 8.0
Input: foldr (/) 3 []
Output: 3.0
Input: foldr (&&) True [1>2,3>2,5==5]
Output: False
Input: foldr max 18 [3,6,12,4,55,11]
Output: 55
Input: foldr max 111 [3,6,12,4,55,11]
Output: 111
Input: foldr (\x y -> (x+y)/2) 54 [12,4,10,6]
Output: 12.0