lisa.utils.fold#
- lisa.utils.fold(f, xs, init=None)[source]#
Fold the given function over
xs
, withinit
initial accumulator value.This is very similar to
functools.reduce()
, except that it is not assumed that the function returns values of the same type as the item type.This means that this function enforces non-empty input.