import itertools


def decaying(start, decay):
    """Return an iterator of exponentially decaying values.

    The first value is ``start``. Every further value is obtained by multiplying
    the last one by a factor of ``decay``.

    Examples
    --------

    >>> from climin.schedule import decaying
    >>> s = decaying(10, .9)
    >>> [s.next() for i in range(5)]
    [10.0, 9.0, 8.100000000000001, 7.290000000000001, 6.561]
    """
    return (start * decay ** i for i in itertools.count(0))