Created
March 11, 2013 08:48
-
-
Save sonygod/5132862 to your computer and use it in GitHub Desktop.
haxe3 bind Test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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