def iterate(f: Callable[[T], T], x: T) -> Iterator[T]:
    """ Makes infinite iterator that returns the result of successive
    applications of a function to an element

    .. math::
        iterate(f, x) = [x, f(x), f(f(x)), f(f(f(x))), ...]

    Examples
    --------
    >>> from delphi.utils.fp import iterate, take
    >>> list(take(5, iterate(lambda x: x*2, 1)))
    [1, 2, 4, 8, 16]
    """
    return scanl(lambda x, _: f(x), x, repeat(None))
def iterate ( f : Callable [ [ T ] , T ] , x : T ) -> Iterator [ T ] : return scanl ( lambda x , _ : f ( x ) , x , repeat ( None ) )
Makes infinite iterator that returns the result of successive
    applications of a function to an element

    .. math::
        iterate(f, x) = [x, f(x), f(f(x)), f(f(f(x))), ...]

    Examples
    --------
    >>> from delphi.utils.fp import iterate, take
    >>> list(take(5, iterate(lambda x: x*2, 1)))
    [1, 2, 4, 8, 16]