mapAccumWithKey

The function mapAccumWithKey threads an accumulating argument through the map in ascending order of keys.
let f a k b = (a ++ " " ++ (show k) ++ "-" ++ b, b ++ "X")
mapAccumWithKey f "Everything:" (fromList [(5,"a"), (3,"b")]) == ("Everything: 3-b 5-a", fromList [(3, "bX"), (5, "aX")])
The function mapAccumWithKey threads an accumulating argument through the map in ascending order of keys.
let f a k b = (a ++ " " ++ (show k) ++ "-" ++ b, b ++ "X")
mapAccumWithKey f "Everything:" (fromList [(5,"a"), (3,"b")]) == ("Everything: 3-b 5-a", fromList [(3, "bX"), (5, "aX")])
The function mapAccumWithKey threads an accumulating argument through the map in ascending order of keys.
let f a k b = (a ++ " " ++ (show k) ++ "-" ++ b, b ++ "X")
mapAccumWithKey f "Everything:" (fromList [(5,"a"), (3,"b")]) == ("Everything: 3-b 5-a", fromList [(3, "bX"), (5, "aX")])
O(n). The function mapAccumWithKey threads an accumulating argument through the map in ascending order of keys.
let f a k b = (a ++ " " ++ (show k) ++ "-" ++ b, b ++ "X")
mapAccumWithKey f "Everything:" (fromList [(5,"a"), (3,"b")]) == ("Everything: 3-b 5-a", fromList [(3, "bX"), (5, "aX")])
The function mapAccumWithKey threads an accumulating argument through the map in unspecified order of keys.
O(n). The function mapAccumWithKey threads an accumulating argument through the map in ascending order of keys.
let f a k b = (a ++ " " ++ (show k) ++ "-" ++ b, b ++ "X")
mapAccumWithKey f "Everything:" (fromList ((5,"a") :| [(3,"b")])) == ("Everything: 3-b 5-a", fromList ((3, "bX") :| [(5, "aX")]))
O(n). The function mapAccumWithKey threads an accumulating argument through the map in ascending order of keys.
let f a k b = (a ++ " " ++ (show k) ++ "-" ++ b, b ++ "X")
mapAccumWithKey f "Everything:" (fromList ((5,"a") :| [(3,"b")])) == ("Everything: 3-b 5-a", fromList ((3, "bX") :| [(5, "aX")]))
O(n). The function mapAccumWithKey threads an accumulating argument through the map in ascending order of keys.
O(n). The function mapAccumWithKey threads an accumulating argument through the map in ascending order of keys.
let f a k b = (a ++ " " ++ (show k) ++ "-" ++ b, b ++ "X")
mapAccumWithKey f "Everything:" (fromList [(5,"a"), (3,"b")]) == ("Everything: 3-b 5-a", fromList [(3, "bX"), (5, "aX")])
O(n). The function mapAccumWithKey threads an accumulating argument through the map in ascending order of keys.
The mapAccumWithKeyL function behaves like a combination of mapWithKey and foldlWithKey; it applies a function to each element of a structure, passing an accumulating parameter from left to right, and returning a final value of this accumulator together with the new structure.
The mapAccumWithKeyR function behaves like a combination of mapWithKey and foldrWithKey; it applies a function to each element of a structure, passing an accumulating parameter from right to left, and returning a final value of this accumulator together with the new structure.