Most of the functions in this module are a alias for the same function in Id.List, which can handle both 'Id.List' and 'CounterList'
Create a empty CounterList
Create a 'CounterList' with a single Id-value pair
Create a new CounterList from a list of values and assign an Id to every value
Create a new CounterList from a list of Id-value pairs.
This removes pairs with duplicate Ids
Convert a Id.CounterDict into a CounterList.
Convert a CounterList into a Id.List.
Convert a CounterList into a Id.CounterDict.
Get the counter from a counter list
Determine if a list is empty.
Determine the number of Id-value pairs in the list.
Determine if a Id is in a list.
Get the value associated with a Id. If the Id is not found, return Nothing.
Same as get but with the arguments swapped, useful for pipelines.
Add a value to the List and assign it a new Id.
Same as as add but only returns the List
Add a value to the List, assign it a new Id and insert it at a given index.
Indexes lower than 0 will be inserted at index 0.
Indexes higher than the length of the list will inserted at the end of the list.
Add a list of values to the List and assign them Ids
Insert a Id-value pair into a list. If there is a existing pair with the same Id if will be replaced. If there isn't a existing pair the pair will be inserted at the start of the list.
Insert a Id-value pair into a given index into a Id.List. This will remove any existing value with the same Id. Indexes lower than 0 will be inserted at index 0. Indexes higher than the length of the list will inserted at the end of the list.
Move a existing value to a new index. Does nothing if the item is not present.
Remove a Id-value pair from a list. If the Id is not found, no changes are made.
Update the value of a list for a specific Id with a given function. If the Id is not found, no changes are made.
Apply a function to all values in a list.
Keep only the Id-value pairs that pass the given test.
Apply a function to all values in the list and filter out the values that return Nothing.
Fold over the Id-value pairs in a list from left to right.
Fold over the Id-value pairs in a list from right to left.
Get all of the Ids in a list, sorted from lowest to highest.
Get all of the values in a list, in the order of their Ids.
Partition a list according to some test.
The first list contains all Id-value pairs which passed the test, and the second contains the pairs that did not.
The first list retains the Id counter while the second is turned into a Id.List
Keep a Id-value pair when its Id does not appear in the second list.
Keep a Id-value pair when its Id appears in the second list. Preference is given to values in the first list.
Combine two Lists. If there is a collision, preference is given to the first List.
Decompose a list of tuples into a tuple of lists.
Encode CounterList to a JSON value
JSON Decoder for CounterList
A 'leaky' JSON Decoder for CounterList.
This decoder will try to succeed to even if parts of json value can't be decoded.
If the counter can't be decoded a new counter will be assigned, accounting for all used Ids in the list.
If any items in the list have a invalid Id they will be assigned a new Id.
If any items in the list cannot be decoded they will be skipped.
A list with a id counter