definition: |
mapAccumR :: (acc -> x -> (acc, y)) -> acc -> [x] -> (acc, [y]) mapAccumR _ s [] = (s, []) mapAccumR f s (x:xs) = (s'', y:ys) where (s'',y ) = f s' x (s', ys) = mapAccumR f s xs |
demand: |
argument 3 |
deterministic: |
deterministic operation |
documentation: |
The `mapAccumR` function behaves like a combination of `map` and `foldr`; it applies a function to each element of a list, passing an accumulating parameter from right to left, and returning a final value of this accumulator together with the new list. |
failfree: |
(_, _, _) |
indeterministic: |
referentially transparent operation |
infix: |
no fixity defined |
iotype: |
{(_,_,{[]}) |-> {(,)} || (_,_,{:}) |-> {(,)}} |
name: |
mapAccumR |
precedence: |
no precedence defined |
result-values: |
{(,)} |
signature: |
(a -> b -> (a, c)) -> a -> [b] -> (a, [c]) |
solution-complete: |
operation might suspend on free variables |
terminating: |
yes |
totally-defined: |
reducible on all ground data terms |