from typing import Callable
from typing import Any
from typing import Reversible
from functools import reduce


def foldr(func: Callable[[Any, Any], Any], it: Reversible[Any]):
    """
    Right-fold iterable object

    Args:
        func: Two arguments function
        it: Reversible(Iterable) object

    Examples:
        >>> fpsm.foldr(lambda x ,y: x - y, range(11))
        5
    """
    return reduce(lambda x, y: func(y, x), reversed(it), 0)