function comp(f, g){ return function(x){ return f(g(x)); } } function test(x){ return x + " test"; } print (comp(test,comp(test,test))("test "));