Implement mapAccumRWithKey
Implement mapAccumRWithKey