foldlWithKey
O(n). Fold the keys and values in the map using the given left-associative binary operator, such that foldlWithKey f z == foldl (\z' (kx, x) -> f z' kx x) z . toAscList.
For example,
> keys = reverse . foldlWithKey (\ks k x -> k:ks) []
> let f result k a = result ++ "(" ++ (show k) ++ ":" ++ a ++ ")"
> foldlWithKey f "Map: " (fromList [(5,"a"), (3,"b")]) == "Map: (3:b)(5:a)"
O(n). Fold the keys and values in the map using the given left-associative binary operator, such that foldlWithKey f z == foldl (\z' (kx, x) -> f z' kx x) z . toAscList.
For example,
> keys = reverse . foldlWithKey (\ks k x -> k:ks) []
> let f result k a = result ++ "(" ++ (show k) ++ ":" ++ a ++ ")"
> foldlWithKey f "Map: " (fromList [(5,"a"), (3,"b")]) == "Map: (3:b)(5:a)"
O(n). A strict version of foldlWithKey. Each application of the operator is evaluated before using the result in the next application. This function is strict in the starting value.
O(n). A strict version of foldlWithKey. Each application of the operator is evaluated before using the result in the next application. This function is strict in the starting value.