lihuanshuai
10/24/2016 - 2:12 AM

合成函数 from: https://mathieularose.com/function-composition-in-python/

def compose(*functions):
    return functools.reduce(lambda f, g: lambda x: f(g(x)), functions, lambda x: x)