Functional Programming

Oren Tirosh oren-py-l at hishome.net
Tue Dec 31 04:23:37 EST 2002


On Sun, Dec 29, 2002 at 09:51:24PM -0600, Mike Meyer wrote:
> The definition of curry is:
> 
> class curry:
>    def __init__(self, func, *fixed_args):
>       self.func = func
>       self.fixed_args = fixed_args
> 
>    def __call__(self, *variable_args):
>       return apply(self.func, self.fixed_args + variable_args)

def curry(func, *fixed_args):

    def curried(*variable_args):
        return func( *(fixed_args+variable_args) )

    return curried

No lambdas. No objects. No double-underscores.

        Oren




More information about the Python-list mailing list