Functional Programming

Bengt Richter bokr at oz.net
Tue Dec 31 13:00:24 EST 2002


On Tue, 31 Dec 2002 11:23:37 +0200, Oren Tirosh <oren-py-l at hishome.net> wrote:

>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.
Right, but all your curried functions will have the same
__name__ : "curried".
(See a previous post of mine for an alternative ;-)

Regards,
Bengt Richter



More information about the Python-list mailing list