Actionscript:
-
var a:Array = [1,2,3,4,5,6];
-
var double:Array = a.map(function():int{return arguments[0] * 2});
-
trace(double);
-
/*outputs:
-
2,4,6,8,10,12
-
*/
A condensed example of Array.map()
Here is the same thing written in haskell:
a = [1,2,3,4,5,6] double = map (*2) a main = print double