A minimal compose implementation.
Given a list of functions, apply them squentially to an argument. This is equivalent to:
funcs = [h, ..., g] compose(x, funcs) == g(...(h(x)))
Example usage:
funcs = [lambda x: x ** 3, lambda x: x + 5, lambda x: x * 3] data = 2 compose(data, funcs) # ans: 39
Lint:
mypy compose.py black --check
Test:
pytest --doctest-modules -vvv compose.py