Anonymous user
Function composition: Difference between revisions
Javascript
(Joy) |
(Javascript) |
||
Line 83:
Prelude> sin_asin 0.5
0.5</lang>
=={{header|Javascript}}==
<lang javascript>
function compose(f, g) {
return function(x) { return f(g(x)) }
}
var id = compose(Math.sin, Math.asin)
print id(0.5) // 0.5
</lang>
=={{header|Joy}}==
|