Fork of elm/core
's Set
, bypassing the
"comparable"-key limitation for UUID
s.
Also includes some extras.
Insert, remove, and query operations all take O(log n) time.
Represents a set of unique UUID
s.
empty : Set
Create an empty set.
singleton : UUID -> Set
Create a set with one UUID
.
insert : UUID -> Set -> Set
Insert a UUID
into a set.
remove : UUID -> Set -> Set
Remove a UUID
from a set. If the UUID
is not found, no changes are made.
isEmpty : Set -> Basics.Bool
Determine if a set is empty.
member : UUID -> Set -> Basics.Bool
Determine if an UUID
is in a set.
size : Set -> Basics.Int
Determine the number of elements in a set.
union : Set -> Set -> Set
Get the union of two sets. Keep all values.
intersect : Set -> Set -> Set
Get the intersection of two sets. Keeps values that appear in both sets.
diff : Set -> Set -> Set
Get the difference between the first set and the second. Keeps values that do not appear in the second set.
toList : Set -> List UUID
Convert a set into a list, sorted from lowest to highest.
fromList : List UUID -> Set
Convert a list into a set, removing any duplicates.
map : (UUID -> comparable) -> Set -> Set comparable
Map a function onto an elm/core
's Set
,
creating a new set with no duplicates.
foldl : (UUID -> b -> b) -> b -> Set -> b
Fold over the values in a set, in order from lowest to highest.
foldr : (UUID -> b -> b) -> b -> Set -> b
Fold over the values in a set, in order from highest to lowest.
filter : (UUID -> Basics.Bool) -> Set -> Set
Only keep elements that pass the given test.
See elm/core
's Set.filter
for the original version.
partition : (UUID -> Basics.Bool) -> Set -> ( Set, Set )
Create two new sets. The first contains all the elements that passed the given test, and the second contains all the elements that did not.
getFirst : Set -> Maybe UUID
Retrieve the node with the smallest key.
toggle : UUID -> Set -> Set
Like insert, but removes if the key already exists int the set, discarding the new value too.