def right_associative(func):
    """
    Decorator: convert a binary function to a right associative n-ary function.

    Example:
        right_associative(f)(x, y, z) is equivalent to f(x, f(y, z))
    """
    def ra_func(x, *args):
        return x if not args else func(x, ra_func(*args))
    return ra_func