A set of unique values. The values can be any type, as the implementation is based on AssocList
Represents a set of unique values. So (Set Int)
is a set of integers and
(Set String)
is a set of strings.
empty : EverySet a
Create an empty set.
singleton : a -> EverySet a
Create a set with one value.
insert : a -> EverySet a -> EverySet a
Insert a value into a set.
remove : a -> EverySet a -> EverySet a
Remove a value from a set. If the value is not found, no changes are made.
isEmpty : EverySet a -> Basics.Bool
Determine if a set is empty.
member : a -> EverySet a -> Basics.Bool
Determine if a value is in a set.
size : EverySet a -> Basics.Int
Determine the number of elements in a set.
union : EverySet a -> EverySet a -> EverySet a
Get the union of two sets. Keep all values.
intersect : EverySet a -> EverySet a -> EverySet a
Get the intersection of two sets. Keeps values that appear in both sets.
diff : EverySet a -> EverySet a -> EverySet a
Get the difference between the first set and the second. Keeps values that do not appear in the second set.
toList : EverySet a -> List a
Convert a set into a list, sorted from lowest to highest.
fromList : List a -> EverySet a
Convert a list into a set, removing any duplicates.
map : (a -> a2) -> EverySet a -> EverySet a2
Map a function onto a set, creating a new set with no duplicates.
foldl : (a -> b -> b) -> b -> EverySet a -> b
Fold over the values in a set, in order from lowest to highest.
foldr : (a -> b -> b) -> b -> EverySet a -> b
Fold over the values in a set, in order from highest to lowest.
filter : (a -> Basics.Bool) -> EverySet a -> EverySet a
Create a new set consisting only of elements which satisfy a predicate.
partition : (a -> Basics.Bool) -> EverySet a -> ( EverySet a, EverySet a )
Create two new sets; the first consisting of elements which satisfy a predicate, the second consisting of elements which do not.