intersectionWith

intersectionWith :: (a -> b -> c) -> IntMap a -> IntMap b -> IntMap c
containers Data.IntMap.Strict, containers Data.IntMap.Lazy
O(n+m). The intersection with a combining function. > intersectionWith (++) (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == singleton 5 "aA"
intersectionWith :: Ord k => (a -> b -> c) -> Map k a -> Map k b -> Map k c
containers Data.Map.Lazy, containers Data.Map.Strict
O(n+m). Intersection with a combining function. The implementation uses an efficient hedge algorithm comparable with hedge-union. > intersectionWith (++) (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == singleton 5 "aA"
intersectionWithKey :: (Key -> a -> b -> c) -> IntMap a -> IntMap b -> IntMap c
containers Data.IntMap.Strict, containers Data.IntMap.Lazy
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"
intersectionWithKey :: Ord k => (k -> a -> b -> c) -> Map k a -> Map k b -> Map k c
containers Data.Map.Lazy, containers Data.Map.Strict
O(n+m). Intersection with a combining function. The implementation uses an efficient hedge algorithm comparable with hedge-union. > 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"