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: | mapAccumR |
Type: | (a -> b -> (a,c)) -> a -> [b] -> (a,[c]) |
Description: | mapAccumR is similar to mapAccumL except that the list is processed from right-to-left rather than left-to-right |
Related: | group, groupBy, inits, intersperse, mapAccumL, nub, nubBy, partition, sort, sortBy, tails, transpose |
Input: mapAccumR (\x y -> (x,x*y)) 5 [9,6,3]
Output: (5,[45,30,15])
Input: mapAccumR (\x y -> (x+y,x*y)) 5 [2,4,8]
Output: (19,[34,52,40])
Input: mapAccumR (\x y -> (x+y,y)) 5 [2,4,8]
Output: (19,[2,4,8])
Input: mapAccumR (\x y -> (y,y)) 5 [2,4,8]
Output: (2,[2,4,8])
Input: mapAccumR (\x y -> (x,x)) 5 [2,4,8]
Output: (5,[5,5,5])