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: | scanl1 |
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. It returns the list of intermediate and final results. |
Related: | foldl, foldl1, foldr, foldr1, scanl, scanr, scanr1 |
Input: scanl1 (+) [1,2,3,4]
Output: [1,3,6,10]
Input: scanl1 (/) [64,4,2,8]
Output: [64.0,16.0,8.0,1.0]
Input: scanl1 (/) [12]
Output: [12.0]
Input: scanl1 (&&) [3>1,3>2,4>6,5==5]
Output: [True,True,False,False]
Input: scanl1 max [3,6,12,4,55,11]
Output: [3,6,12,12,55,55]
Input: scanl1 (\x y -> (x+y)/2) [3,5,10,5]
Output: [3.0,4.0,7.0,6.0]