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: | scanl |
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. It returns the list of intermediate and final results. |
Related: | foldl, foldl1, foldr, foldr1, scanl1, scanr, scanr1 |
Input: scanl (/) 64 [4,2,4]
Output: [64.0,16.0,8.0,2.0]
Input: scanl (/) 3 []
Output: [3.0]
Input: scanl max 5 [1,2,3,4]
Output: [5,5,5,5,5]
Input: scanl max 5 [1,2,3,4,5,6,7]
Output: [5,5,5,5,5,5,6,7]
Input: scanl (\x y -> 2*x + y) 4 [1,2,3]
Output: [4,9,20,43]