Compute a chain of functions in python
functional-programming, python
Solution
Fold while calling.
destination = reduce((lambda x, y: y(x)), function_list, origin)
Problem
I want to get the result of a chain of computations from an initial value. I'm actually using the following code: ``` def function_composition(function_list, origin): destination = origin for func in function_list: destination = func(destination) return destination ``` With each function in `function_list` having a single argument. I'd like to know if there is a similar function in python standard library or a better way (example: using lambdas) to do this.