I have an array of functions and I\'m trying to produce one function which consists of the composition of the elements in my array. My approach is:
def compo
The easiest approach would be first to write a composition of 2 functions:
def compose2(f, g): return lambda *a, **kw: f(g(*a, **kw))
And then use reduce to compose more functions:
reduce
def compose(*fs): return reduce(compose2, fs)
Or you can use some library, which already contains compose function.