Was going to post the same thing as @justinwolf.
Well, I’ll add a little explaination to that:
- in @AlobarNon version each function will be called, and their respective result values will then be passed to
FP.choose()
- in @justinwolf version
FP.choose
will select a random Function
first, and then call it
You can easily check that by running this little snippet and see what it traces out:
var f1:Function = function():int { trace(1); return 1; };
var f2:Function = function():int { trace(2); return 2; };
var f3:Function = function():int { trace(3); return 3; };
trace("AlobarNon:");
trace("choose:", FP.choose(f1(), f2(), f3()));
trace("justinwolf:");
trace("choose:", FP.choose(f1, f2, f3)());