A dictionary mapping unique keys to values. The keys can be any type.
A dictionary of keys and values.
equals : Dict key value -> Dict key value -> Basics.Bool
Determine if two dictionaries contain the same entries.
empty : Dict key value
Create an empty dictionary.
singleton : key -> value -> Dict key value
Create a dictionary with one key-value pair.
insert : Comparable key -> key -> value -> Dict key value -> Dict key value
Insert a key-value pair into a dictionary. Replaces value when there is a collision.
update : Comparable key -> key -> (Maybe value -> Maybe value) -> Dict key value -> Dict key value
Update the value of a dictionary for a specific key with a given function.
remove : Comparable key -> key -> Dict key value -> Dict key value
Remove a key-value pair from a dictionary. If the key is not found, no changes are made.
isEmpty : Dict key value -> Basics.Bool
Determine if a dictionary is empty.
member : Comparable key -> key -> Dict key value -> Basics.Bool
Determine if a key is in a dictionary.
get : Comparable key -> key -> Dict key value -> Maybe value
Get the value associated with a key.
size : Dict key value -> Basics.Int
Determine the number of key-value pairs in the dictionary.
keys : Dict key value -> List key
Get all of the keys in a dictionary, sorted from lowest to highest.
values : Dict key value -> List value
Get all of the values in a dictionary, in the compare of their keys.
toList : Dict key value -> List ( key, value )
Convert a dictionary into an association list of key-value pairs, sorted by keys.
fromList : Comparable key -> List ( key, value ) -> Dict key value
Convert an association list into a dictionary.
map : (key -> value -> otherValue) -> Dict key value -> Dict key otherValue
Apply a function to all values in a dictionary.
foldl : (key -> value -> accumulator -> accumulator) -> accumulator -> Dict key value -> accumulator
Fold over the key-value pairs in a dictionary from lowest key to highest key.
foldr : (key -> value -> accumulator -> accumulator) -> accumulator -> Dict key value -> accumulator
Fold over the key-value pairs in a dictionary from highest key to lowest key.
filter : Comparable key -> (key -> value -> Basics.Bool) -> Dict key value -> Dict key value
Keep only the key-value pairs that pass the given test.
partition : Comparable key -> (key -> value -> Basics.Bool) -> Dict key value -> ( Dict key value, Dict key value )
Partition a dictionary according to some test. The first dictionary contains all key-value pairs which passed the test, and the second contains the pairs that did not.
union : Comparable key -> Dict key value -> Dict key value -> Dict key value
Combine two dictionaries. If there is a collision, preference is given to the first dictionary.
intersect : Comparable key -> Dict key value -> Dict key value -> Dict key value
Keep a key-value pair when its key appears in the second dictionary. Preference is given to values in the first dictionary.
diff : Comparable key -> Dict key value -> Dict key otherValue -> Dict key value
Keep a key-value pair when its key does not appear in the second dictionary.
merge : Comparable key -> (key -> value -> result -> result) -> (key -> value -> otherValue -> result -> result) -> (key -> otherValue -> result -> result) -> Dict key value -> Dict key otherValue -> result -> result
The most general way of combining two dictionaries. You provide three accumulators for when a given key appears: