Developer Tools - Functional Programming

Tools for Python iterables and iterators. Part of the dtools namespace projects.

Functions to concatenate iterables
concat: concatenate multiple iterables sequentially
exhaust: shuffle together multiple iterables until all are exhausted
merge: shuffle together multiple iterables until one is exhausted
Functions to drop or take values from an iterable
drop: return iterator with a given number of values dropped from iterable
drop_while: return iterator of an iterable dropping values where predicate is true
take: take a given number of values from an iterable
take_split: same as take except also return an iterator of the remaining values
take_while: return iterator yielding values while predicate is true
take_while_split: same as take_while except also return an iterator of the remaining values
Functions to accumulate and reduce from an iterable
accumulate: pure Python version of std library's itertools.accumulate
reduce_left: fold an iterable left with a function
fold_left: fold an iterable left with a function and initial value
mb_fold_left: fold an iterable left with a function and optional initial value
Shortcut versions of iterable reducing functions, useful with infinite iterables
sc_reduce_left: short circuit version of a left reduce
sc_reduce_right: short circuit version of a right reduce

Detailed dtools.fp documentation

Archived projects with dtools.iterables history