intersectionWith
O(n+m). The intersection with a combining function.
> intersectionWith (++) (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == singleton 5 "aA"
O(n+m). Intersection with a combining function.
> intersectionWith (++) (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == singleton 5 "aA"
O(n+m). The intersection with a combining function.
> let f k al ar = (show k) ++ ":" ++ al ++ "|" ++ ar
> intersectionWithKey f (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == singleton 5 "5:a|A"
O(n+m). Intersection with a combining function. Intersection is more efficient on (bigset `intersection` smallset).
> let f k al ar = (show k) ++ ":" ++ al ++ "|" ++ ar
> intersectionWithKey f (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == singleton 5 "5:a|A"