isSubsetOf -package:intern
Is this a subset? (s1 `isSubsetOf` s2) tells
whether s1 is a subset of s2.
(s1 `isSubsetOf` s2) indicates whether
s1 is a subset of
s2.
s1 `isSubsetOf` s2 = all (`member` s2) s1
s1 `isSubsetOf` s2 = null (s1 `difference` s2)
s1 `isSubsetOf` s2 = s1 `union` s2 == s2
s1 `isSubsetOf` s2 = s1 `intersection` s2 == s1
Inclusion of sets.
Examples
>>> fromList [1,3] `isSubsetOf` fromList [1,2,3]
True
>>> fromList [1,2] `isSubsetOf` fromList [1,3]
False
Is this a subset? (s1 `isSubsetOf` s2) tells
whether s1 is a subset of s2.
O(m*log(n/m + 1)), m <= n.
(s1 `isSubsetOf` s2)
indicates whether
s1 is a subset of
s2.
s1 `isSubsetOf` s2 = all (`member` s2) s1
s1 `isSubsetOf` s2 = null (s1 `difference` s2)
s1 `isSubsetOf` s2 = s1 `union` s2 == s2
s1 `isSubsetOf` s2 = s1 `intersection` s2 == s1
Checks if the first range is a subset of the second range.
>>> IPv4.isSubsetOf (IPv4.IPv4Range (IPv4.fromOctets 192 0 2 128) 25) (IPv4.IPv4Range (IPv4.fromOctets 192 0 2 0) 24)
True
>>> IPv4.isSubsetOf (IPv4.IPv4Range (IPv4.fromOctets 192 0 2 0) 30) (IPv4.IPv4Range (IPv4.fromOctets 192 0 2 4) 30)
False
Checks if the first range is a subset of the second range.
O(n+m). Is this a subset? (s1 `isSubsetOf` s2) tells
whether s1 is a subset of s2.
O(n+m). Is this a subset? (s1 `isSubsetOf` s2) tells
whether s1 is a subset of s2.
Check whether the first argument is a subset of the second one.
Subset test.
>>> prove $ empty `isSubsetOf` (full :: SSet Integer)
Q.E.D.
>>> prove $ \x (s :: SSet Integer) -> s `isSubsetOf` (x `insert` s)
Q.E.D.
>>> prove $ \x (s :: SSet Integer) -> (x `delete` s) `isSubsetOf` s
Q.E.D.
O(n+m). Is this a subset? (s1 `isSubsetOf` s2) tells
whether s1 is a subset of s2.
O(n+m). Is this a subset? (s1 `isSubsetOf` s2) tells
whether s1 is a subset of s2.
Is this a subset?
(i1 `isSubsetOf` i2) tells whether
i1 is a subset of
i2.
Is this a subset?
(i1 `isSubsetOf` i2) tells whether
i1 is a subset of
i2.
Is this a subset?
(is1 `isSubsetOf` is2) tells whether
is1 is a subset of
is2.
Flipped version of
contains. Check if interval
X a
subset of interval
Y
>>> (25 ... 35 :: Interval Double) `isSubsetOf` (20 ... 40 :: Interval Double)
True
>>> (20 ... 40 :: Interval Double) `isSubsetOf` (15 ... 35 :: Interval Double)
False
O(n+m). Is the first set a subset of the second set? This is
always true for equal sets.
O(n log n). Checks that all elements of the first list are
elements of the second.
O(n+m). Is this a subset?
(s1 isSubsetOf s2)
tells whether
s1 is a subset of
s2.