Skip to content

Instantly share code, notes, and snippets.

@sonygod
Created March 11, 2013 08:48
Show Gist options
  • Save sonygod/5132862 to your computer and use it in GitHub Desktop.
Save sonygod/5132862 to your computer and use it in GitHub Desktop.
haxe3 bind Test
package ;
import haxe.ds.StringMap;
import js.Node;
using Reflect;
import tink.lang.Cls;
//import proxy.Bag;
import proxy.Utype;
import Type;
import format.amf.Tools;
import Lambda;
using Lambda;
/**
* ... AMF READ OR WRITE EXAMPE
* @author sonygod
*/
class Main {
static function main() {
//public function foo(x:Int, y:Int) {return x+y*2;}
var h = new Hello();
var foo_cb = h.foo.bind(_, 5);
var v = foo_cb(2);
trace(v);
var array = [0, 1, 2, 3, 4];
var mappedList = array.map(function(x) { return Math.pow(3, x); });
var mappedList2 = array.map(Math.pow.bind(3, _));
trace(mappedList2);
trace(mappedList);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment