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: | List |
---|---|
Function: | mapAccumL |
Type: | (a -> b -> (a,c)) -> a -> [b] -> (a,[c]) |
Description: | mapAccumL f s l applies f to an accumulating "state" parameter s and to each element of l in turn |
Related: | group, groupBy, inits, intersperse, mapAccumR, nub, nubBy, partition, sort, sortBy, tails, transpose |
Input: mapAccumL (\x y -> (x,x*y)) 5 [9,6,3]
Output: (5,[45,30,15])
Input: mapAccumL (\x y -> (x+y,x*y)) 5 [2,4,8]
Output: (19,[10,28,88])
Input: mapAccumL (\x y -> (x+y,y)) 5 [2,4,8]
Output: (19,[2,4,8])
Input: mapAccumL (\x y -> (y,y)) 5 [2,4,8]
Output: (8,[2,4,8])
Input: mapAccumL (\x y -> (x,x)) 5 [2,4,8]
Output: (5,[5,5,5])