mapAccumR -text +containers

mapAccumRWithKey :: (a -> Key -> b -> (a, c)) -> a -> IntMap b -> (a, IntMap c)
containers Data.IntMap.Strict, containers Data.IntMap.Lazy
O(n). The function mapAccumR threads an accumulating argument through the map in descending order of keys.
mapAccumRWithKey :: (a -> k -> b -> (a, c)) -> a -> Map k b -> (a, Map k c)
containers Data.Map.Lazy, containers Data.Map.Strict
O(n). The function mapAccumR threads an accumulating argument through the map in descending order of keys.