Task

Take a combined set of elements and apply a function to each element.




func map(arr:array,callback:function){
	set newArr:array = [];
	foreach(k,v as arr){
		newArr[k]=callback(v,k,arr);
	}
	send newArr;
}
 
set arr:array = [1,2,3,4,5];
set result:array = map(arr,func(v){
	send v*2;
});
 
log(arr.join(", "));
log(result.join(", "));