from functools import reduce


id = lambda x : x


def dot(f,g):

    return lambda x : f(g(x))


def compose(*fs):

    return reduce(dot,fs,id)


f1 = lambda x : x + 1

f2 = lambda x : x + 2

f3 = lambda x : x + 10


compose(f1,f2,f3)(10)