# receives two functions
# and returns the function which is their composition
# this too is an example of a higher-order function
def compose(f1,f2):
return lambda x:f1(f2(x))
# equivalent implementation using def
def compose(f1,f2):
def com(x):
return f1(f2(x))
return com
# calling example - using lambda functions as arguments
h1 = compose(lambda x:x+1,lambda x:2*x)