Exit (exit v0.3.0)
Various iteration utilities
Description
Mostly wrappers for common patterns using Enum module
Summary
Functions
Convert a list of maps to a map of keys to the maps
Convert a list of maps to a map of items keyed by a given field
Given a list of maps with an id field, return a list of the ids
Given a list, reject any that are nil
Rotate a list by moving the first item from the beginning to the end
Rotate a list n times
Rotate through items until the item is true for f
Rotate through items while each item is true for f
Given 2 maps. zip them where the value is a tuple with the first and second elements belonging to the first and second maps, respectively. If a map does not have an element, the tuple will contain a nil.
Zip 3 maps
Functions
Convert a list of maps to a map of keys to the maps
Convert a list of maps to a map of items keyed by a given field
Will raise an exception if the given field does not exist. Also works on a list of enums with an element index.
Given a list of maps with an id field, return a list of the ids
Given a list, reject any that are nil
Rotate a list by moving the first item from the beginning to the end
Rotate a list n times
Move the first n items to the back of the list
@spec rotate_until([a :: term()], (a :: term() -> as_boolean(term()))) :: [ a :: term() ]
Rotate through items until the item is true for f
@spec rotate_while([a :: term()], (a :: term() -> as_boolean(term()))) :: [ a :: term() ]
Rotate through items while each item is true for f
Given 2 maps. zip them where the value is a tuple with the first and second elements belonging to the first and second maps, respectively. If a map does not have an element, the tuple will contain a nil.
Zip 3 maps
The same behavior as zip_maps/2 but with 3 maps.