import math function compose (f, g) { return function (x) { return f(g(x)) } } var func = compose(Math.sin, Math.asin) println (func(0.5)) // 0.5