intersection

The (left-biased) intersection of two maps (based on keys).
intersection (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == singleton 5 "a"
The intersection of two sets.
Intersection of two maps. Return data in the first map for the keys existing in both maps. (intersection m1 m2 == intersectionWith const m1 m2).
intersection (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == singleton 5 "a"
The intersection of two sets. Elements of the result come from the first set, so for example
import qualified Data.Set as S
data AB = A | B deriving Show
instance Ord AB where compare _ _ = EQ
instance Eq AB where _ == _ = True
main = print (S.singleton A `S.intersection` S.singleton B,
S.singleton B `S.intersection` S.singleton A)
prints (fromList [A],fromList [B]).
The (left-biased) intersection of two maps (based on keys).
Intersection of two maps. Return elements of the first map for keys existing in the second.
Intersection of two sets. Return elements present in both the first set and the second.
>>> HashSet.intersection (HashSet.fromList [1,2,3]) (HashSet.fromList [2,3,4])
fromList [2,3]
The (left-biased) intersection of two maps (based on keys).
intersection (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == singleton 5 "a"
The intersection of two sets.
Form the largest bounding box contained within this given two bounding boxes, or Nothing if the two bounding boxes do not overlap at all.
Intersection of two maps. Return elements of the first map for keys existing in the second.
Intersection of two sets. Return elements present in both the first set and the second.
>>> HashSet.intersection (HashSet.fromList [1,2,3]) (HashSet.fromList [2,3,4])
fromList [2,3]
O(m*log(n/m + 1)), m <= n. Intersection of two maps. Return data in the first map for the keys existing in both maps. (intersection m1 m2 == intersectionWith const m1 m2).
intersection (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == singleton 5 "a"
O(m*log(n/m + 1)), m <= n. The intersection of two sets. Elements of the result come from the first set, so for example
import qualified Data.Set as S
data AB = A | B deriving Show
instance Ord AB where compare _ _ = EQ
instance Eq AB where _ == _ = True
main = print (S.singleton A `S.intersection` S.singleton B,
S.singleton B `S.intersection` S.singleton A)
prints (fromList [A],fromList [B]).
Get the intersection of two containers.
Combine two Map on their shared keys, keeping the value from the first Map
intersection = intersectionWith (\v _ -> v)
>>> intersection (fromList [("C",1),("B",2)]) (fromList [("B",3),("A",4)])
fromList [("B",2)]
O(m * log (n/m + 1), m <= n. Intersection of two maps. Return data in the first map for the keys existing in both maps. (intersection m1 m2 == intersectionWith const m1 m2).
O(n+m). The intersection of two multisets. prints (fromList [A],fromList [B]).