Sorry,

Just pressed replay.....

---------- Forwarded message ----------
From: Julio Oña <[EMAIL PROTECTED] >
Date: May 17, 2006 5:09 PM
Subject: Re: [mochikit] Re: Missing one function function ...
To: Jorge Godoy <[EMAIL PROTECTED]>

Hi,

This is more like reduce on list comprehension:

I think in python it should be something like:

Having defined:

def fa(value):
    return .....

def fb(value):
    return ....

def fc(value):
    return ....

function_list=[fa,fb,fc]


Or composition function is:

def compose(function_list, value)
    return reduce(lambda fn, value: fn(value), function_list, value)


so you could call:

result = compose(function_list, value)

Regards.



On 5/17/06, Jorge Godoy < [EMAIL PROTECTED]> wrote:

Em Quarta 17 Maio 2006 05:42, Bob Ippolito escreveu:

> What are some use cases for this? What is construct typically named?
> I can't recall ever running across a library or language that has a
> composition function like that.

Fromwhat I understood, this looks like a Python decorator.

    @decorator
    def function(param1, param2):
        pass

is the same as

    def function(param1, param2):
        pass

    function = decorator(function)


But I might be wrong...  I'm just waking up... ;-)


--
Jorge Godoy      < [EMAIL PROTECTED]>




--
Julio
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "MochiKit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/mochikit
-~----------~----~----~----~------~----~------~--~---

Reply via email to