data Set a { } #
Tip
Bin
empty :: Set a { } #
O(1). The empty set.
singleton :: a -> Set a { } #
O(1). A set with a single element.
fromList :: (Ord a) => [a] -> Set a { } #
O(n * log n). Build a set from a list of elements.
fromAscList :: (Eq a) => [a] -> Set a { } #
O(n). Build a set from an ascending list of elements.
fromDescList :: (Eq a) => [a] -> Set a { } #
O(n). Build a set from a descending list of elements.
insert :: (Ord a) => a -> (Set a) -> Set a { } #
O(log n). Insert an element into the set.
delete :: (Ord a) => a -> (Set a) -> Set a { } #
O(log n). Delete an element from the set.
member :: (Ord a) => a -> (Set a) -> Bool { } #
O(log n). Is the element a member of the set?
notMember :: (Ord a) => a -> (Set a) -> Bool { } #
O(log n). Is the element not a member of the set?
lookupLT :: (Ord a) => a -> (Set a) -> Maybe a { } #
O(log n). Find the largest element smaller than the given one.
lookupGT :: (Ord a) => a -> (Set a) -> Maybe a { } #
O(log n). Find the smallest element larger than the given one.
lookupLE :: (Ord a) => a -> (Set a) -> Maybe a { } #
O(log n). Find the largest element less than or equal to the given one.
lookupGE :: (Ord a) => a -> (Set a) -> Maybe a { } #
O(log n). Find the smallest element greater than or equal to the given one.
null :: (Set a) -> Bool { } #
O(1). Is the set empty?
size :: (Set a) -> Int { } #
O(1). The number of elements in the set.
isSubsetOf :: (Ord a) => (Set a) -> (Set a) -> Bool { } #
O(n * log n). Is the first set a subset of the second?
isProperSubsetOf :: (Ord a) => (Set a) -> (Set a) -> Bool { } #
O(n * log n). Is the first set a proper subset of the second?
union :: (Ord a) => (Set a) -> (Set a) -> Set a { } #
O(m * log(n\m + 1)), m <= n/. Union of two sets.
unions :: (Foldable f, Ord a) => (f (Set a)) -> Set a { } #
O(m * log(n\m + 1)), m <= n/. Union of a foldable of sets.
difference :: (Ord a) => (Set a) -> (Set a) -> Set a { } #
O(m * log(n\m + 1)), m <= n/. Difference of two sets.
\\ :: (Ord a) => (Set a) -> (Set a) -> Set a { } #
O(m * log(n\m + 1)), m <= n. Infix operator for difference<a>.
O(m * log(n\m + 1)), m <= n/. Intersection of two sets.
disjoint :: (Ord a) => (Set a) -> (Set a) -> Bool { } #
O(m * log(n\m + 1)), m <= n/. Check if two sets are disjoint (no common elements).
filter :: (a -> Bool) -> (Set a) -> Set a { } #
O(n). Filter elements satisfying a predicate.
partition :: (a -> Bool) -> (Set a) -> (Set a, Set a) { } #
O(n). Partition the set according to a predicate.
split :: (Ord a) => a -> (Set a) -> (Set a, Set a) { } #
O(log n). Split the set at an element. Returns elements less than
splitMember :: (Ord a) => a -> (Set a) -> (Set a, Bool, Set a) { } #
map :: (Ord b) => (a -> b) -> (Set a) -> Set b { } #
mapMonotonic :: (a -> b) -> (Set a) -> Set b { } #
O(n). Map a strictly monotonic function over the set.
foldr :: (a -> b -> b) -> b -> (Set a) -> b { } #
O(n). Fold the elements using a right-associative operator.
foldl :: (a -> b -> a) -> a -> (Set b) -> a { } #
O(n). Fold the elements using a left-associative operator.
foldr' :: (a -> b -> b) -> b -> (Set a) -> b { } #
O(n). Strict right fold.
foldl' :: (a -> b -> a) -> a -> (Set b) -> a { } #
O(n). Strict left fold.
lookupMin :: (Set a) -> Maybe a { } #
O(log n). Lookup the minimum element.
lookupMax :: (Set a) -> Maybe a { } #
O(log n). Lookup the maximum element.
findMin :: (Set a) -> a { } #
O(log n). Find the minimum element.
findMax :: (Set a) -> a { } #
O(log n). Find the maximum element.
deleteMin :: (Set a) -> Set a { } #
O(log n). Delete the minimum element.
deleteMax :: (Set a) -> Set a { } #
O(log n). Delete the maximum element.
minView :: (Set a) -> Maybe (a, Set a) { } #
O(log n). Retrieve and delete the minimum element.
maxView :: (Set a) -> Maybe (a, Set a) { } #
O(log n). Retrieve and delete the maximum element.
elems :: (Set a) -> [a] { } #
O(n). Return all elements as a list in ascending order.
toList :: (Set a) -> [a] { } #
O(n). Convert to a list in ascending order.
toAscList :: (Set a) -> [a] { } #
O(n). Convert to an ascending list.
toDescList :: (Set a) -> [a] { } #
O(n). Convert to a descending list.
balance :: a -> (Set a) -> (Set a) -> Set a { } #
insertMin :: a -> (Set a) -> Set a { } #
insertMax :: a -> (Set a) -> Set a { } #
glue :: (Set a) -> (Set a) -> Set a { } #
otherwise :: { } #
merge :: (Set a) -> (Set a) -> Set a { } #
instance Ord a => Semigroup (Set a) { }
instance Ord a => Monoid (Set a) { }
instance Foldable Set { }