January 2008
1 post
Function composition in Python
def compose(fns):      return reduce(lambda f, g: lambda x: f(g(x)), fns) a = lambda x: x + 10 b = lambda x: x * 2   c = compose([a, b]) # a(b(x)) = (x * 2) +  10 c(1) » 12 
Jan 5th