Function composition: Difference between revisions

Added an ActionScript version.
(Added PicoLisp)
(Added an ActionScript version.)
Line 6:
 
Hint: Implementing <span style="font-family:serif">compose</span> correctly requires creating a [[wp:Closure (computer science)|closure]]. If your language does not support closures directly, you will need to implement it yourself.
 
=={{header|ActionScript}}==
ActionScript supports closures, making function composition very straightforward.
<lang ActionScript>function compose(f:Function, g:Function):Function {
return function(x:Object) {return f(g(x));};
}
function test() {
trace(compose(Math.atan, Math.tan)(0.5));
}</lang>
 
=={{header|Ada}}==
Anonymous user