A set of unique values. The values can be any type, and the comparison is
done using a function compare : value -> comparable
.
Insert, remove, and query operations all take O(log n) time.
Represents a set of unique values together with the compare function
empty : (a -> comparable) -> DictSet comparable a
Create an empty set
singleton : (a -> comparable) -> a -> DictSet comparable a
Create a set with one value
insert : a -> DictSet comparable a -> DictSet comparable a
Insert a new value into a set
remove : a -> DictSet comparable a -> DictSet comparable a
Remove a value from a set
isEmpty : DictSet comparable a -> Basics.Bool
Determine if a set is empty
member : a -> DictSet comparable a -> Basics.Bool
Determine if a value is in a set
size : DictSet comparable a -> Basics.Int
Determine the number of elements in a set
union : DictSet comparable a -> DictSet comparable a -> DictSet comparable a
Get the union of two sets. Keep all values.
intersect : DictSet comparable a -> DictSet comparable a -> DictSet comparable a
Get the intersection of two sets. Keeps values that appear in both sets.
diff : DictSet comparable a -> DictSet comparable a -> DictSet comparable a
Get the difference between the first set and the second. Keeps values that do not appear in the second set.
toList : DictSet comparable a -> List a
Convert a set into a list.
fromList : (a -> comparable) -> List a -> DictSet comparable a
Convert a list into a set, removing any duplicates.
keys : DictSet comparable a -> List comparable
Extract the keys from a DictSet
values : DictSet comparable a -> List a
Extract the values from a DictSet
map : (b -> comparable) -> (a -> b) -> DictSet comparable a -> DictSet comparable b
Map a function onto a set, creating a new set with no duplicates.
foldl : (a -> b -> b) -> b -> DictSet comparable a -> b
Fold over the values in a set, in order from lowest to highest.
foldr : (a -> b -> b) -> b -> DictSet comparable a -> b
Fold over the values in a set, in order from highest to lowest.
filter : (a -> Basics.Bool) -> DictSet comparable a -> DictSet comparable a
Create a new set consisting only of elements which satisfy a predicate.
partition : (a -> Basics.Bool) -> DictSet comparable a -> ( DictSet comparable a, DictSet comparable a )
Create two new sets; the first consisting of elements which satisfy a