caldera.utils.functional¶
functional.py.
Functional programming methods.
Generally, functions are named by verb-noun-qualifier
verbs
ignore - returned function ignores certain elements of the iterator, returning an iterator of the remaining elements. return - returns the result of the function, rather than another iterator. group - returned function returns an iterator of groups (i.e. iterables of each element T, such as List[T]), instead of map - applies a new function to elements of the iterator
nouns
each - returned function applies to each element in the iterator all - returned function applies to the entire iterator, rather than to each element
qualifier
until - iterates until some condition is met
Special Methods (i.e. piping methods)
compose
Functions
|
|
|
|
|
|
|
|
|
Create a function composition. |
|
Applies a function to the iterator and then consumes. |
|
|
|
|
|
|
|
Non-tee version of enumerate. |
|
|
|
|
|
|
|
|
|
|
|
|
|
Returns a new function the groups iterables by chunks of the specified size. |
|
|
|
pipe( fn_side_effect(fn_next(n)) ) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Apply the function to the iterator itself. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Return a function equivalent to lambda args: f(*args) |
|
|
|
|
|
Tee the iterator and apply a new series of functions without affecting the primary iterator. |
|
|
|
Catches the provided exceptions. |
|
|
|
|
|
|
|
|
|
|