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.
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
-~----------~----~----~----~------~----~------~--~---
- [mochikit] Missing one function function ... GHUM
- [mochikit] Re: Missing one function function ... Bob Ippolito
- [mochikit] Re: Missing one function function .... Harald Armin Massa
- [mochikit] Re: Missing one function function .... Arnar Birgisson
- [mochikit] Re: Missing one function function .... Jorge Godoy
- [mochikit] Fwd: [mochikit] Re: Missing one... Julio Oña
- [mochikit] Re: Fwd: [mochikit] Re: Mis... Arnar Birgisson
- [mochikit] Re: Missing one function functi... Arnar Birgisson
- [mochikit] Re: Missing one function fu... Arnar Birgisson
- [mochikit] Re: Missing one functi... Bob Ippolito
- [mochikit] Re: Missing one fu... Arnar Birgisson
- [mochikit] Re: Missing on... Leonardo Soto
- [mochikit] Re: Missing on... Bob Ippolito
- [mochikit] Re: Missing on... Arnar Birgisson
- [mochikit] Re: Missing one fu... GHUM
- [mochikit] Re: Missing on... Bob Ippolito
