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: | scanr1 |
Type: | (a -> a -> a) -> [a] -> [a] |
Description: | it takes the last two items of the list and applies the function, then it takes the third item from the end and the result, and so on. It returns the list of inntermediate and final results. |
Related: | foldl, foldl1, foldr, foldr1, scanl, scanl1, scanr |
Input: scanr1 (+) [1,2,3,4]
Output: [10,9,7,4]
Input: scanr1 (/) [8,12,24,2]
Output: [8.0,1.0,12.0,2.0]
Input: scanr1 (/) [12]
Output: [12.0]
Input: scanr1 (&&) [1>2,3>2,5==5]
Output: [False,True,True]
Input: scanr1 max [3,6,12,4,55,11]
Output: [55,55,55,55,55,11]
Input: scanr1 (\x y -> (x+y)/2) [12,4,10,6]
Output: [9.0,6.0,8.0,6.0]