|
Module SetThis module is undocumented. This is a list of its definitions. contains :: Set.T a -> a -> Boolean Returns empty :: Set.T a The empty set. fold :: (a -> b -> <c> a) -> a -> Set.T b -> <c> a Folds over all values of the set starting with the given initial value. The folded function receives the accumulator as its first parameter and the value as its second. The set has no specified iteration order, so only order-insensitive combinations give a reproducible result. Example:
fromList :: [a] -> Set.T a Creates a set containing the values of the given list. Duplicates in the list collapse into one value, so the result can be smaller than the list. Example:
The result is sorted because the order in which isEmpty :: Set.T a -> Boolean Returns iter :: (a -> <c> b) -> Set.T a -> <c> () Calls the given function with all values of the set. iterB :: (a -> <b> Boolean) -> Set.T a -> <b> Boolean Calls the given function with the values of the set until it returns The returned boolean therefore answers "was the iteration allowed to finish",
not "did any value match". It is Example:
The second call stops as soon as it reaches the value iterI :: (Integer -> a -> <c> b) -> Set.T a -> <c> () Calls the given function with all values of the set, giving also a running index as the first parameter. The index starts from zero. The index is only a counter of how many values have been visited; it is not a position, because the set has no specified iteration order. Iterating a set of three values always produces the indices 0, 1 and 2, but which value gets which index is unspecified. Example:
singleton :: a -> Set.T a A set containing just the given value. size :: Set.T a -> Integer The number of values in the set. toList :: Set.T a -> [a] The values of the set as a list. The order of the list is not specified;
sort it if a reproducible order is needed. See |