|
Module MSetThis module is undocumented. This is a list of its definitions. add :: MSet.T a -> a -> <Proc> Boolean Adds the given value to the set. Returns addAll :: MSet.T a -> [a] -> <Proc> Boolean Adds all values of the given list to the set. Returns Example:
addAllS :: MSet.T a -> MSet.T a -> <Proc> Boolean Adds all values of the second set to the first one. Returns It is the first argument that is mutated; the second one is only read. Example:
all :: (a -> <b> Boolean) -> MSet.T a -> <b,Proc> Boolean Returns clear :: MSet.T a -> <Proc> () Removes all values from the set. concatMap :: (a -> <c> MSet.T b) -> MSet.T a -> <Proc,c> MSet.T b Creates a new set containing all values of all sets produced by the given function. contains :: MSet.T a -> a -> <Proc> Boolean Returns create :: () -> <Proc> MSet.T a Creates a new empty set. createC :: Integer -> <Proc> MSet.T a Creates a new empty set with room for the given number of values. createConcurrentHashMapKeySet :: () -> <Proc> MSet.T a Creates a new empty set that is safe to use from multiple threads. createConcurrentSkipListSet :: () -> <Proc> MSet.T a Creates a new empty set that is safe to use from multiple threads and keeps its values in ascending order. filterInPlace :: (a -> <b> Boolean) -> MSet.T a -> <b,Proc> () Removes from the set all values that do not satisfy the given predicate. Unlike Example:
fold :: (a -> b -> <c> a) -> a -> MSet.T b -> <Proc,c> a Folds over all values of the set starting with the given initial value. freeze :: MSet.T a -> <Proc> Set.T a Converts the mutable set into an immutable one without copying the underlying data. This only changes how the structure is treated by the SCL type system; it is an O(1) operation, not a copy. The original mutable set must not be used anymore after this. The result aliases the original: it is the same object, only retyped. Every
subsequent mutation of the mutable set is visible through the supposedly
immutable one, as the first example below shows. That is why the original must be
dropped. When both are needed, take a copy with Examples:
fromList :: [a] -> <Proc> MSet.T a Creates a new set containing the values of the given list. isEmpty :: MSet.T a -> <Proc> Boolean Returns iter :: (a -> <c> b) -> MSet.T a -> <c,Proc> () Calls the given function with all values of the set. iterB :: (a -> <b> Boolean) -> MSet.T a -> <b,Proc> Boolean Calls the given function with the values of the set until it returns The result means "was not interrupted", not "found something". See
map :: (a -> <c> b) -> MSet.T a -> <c,Proc> MSet.T b Creates a new set containing the values of the given set mapped with the given function. The result can be smaller than the input: if the function maps two distinct values to the same result, the set keeps only one of them. This is a set, not a list, so there is no size-preservation guarantee. Example:
mapFirst :: (a -> <c> Maybe b) -> MSet.T a -> <c,Proc> Maybe b Applies the given function to the values of the set until it returns Despite the name, "first" is meaningless here: this is a hash set, so its
iteration order is not a contract. If the function returns Example:
remove :: MSet.T a -> a -> <Proc> Boolean Removes the given value from the set. Returns removeAll :: MSet.T a -> [a] -> <Proc> Boolean Removes all values of the given list from the set. Returns singleton :: a -> <Proc> MSet.T a Creates a new set containing just the given value. size :: MSet.T a -> <Proc> Integer The number of values in the set. toList :: MSet.T a -> <Proc> [a] The values of the set as a list. This copies: the returned list is independent of
the set, which stays usable. Contrast The set is hash-based, so the order of the returned list is not a contract.
|