September Morn Update

This commit is contained in:
Ingy döt Net 2019-09-12 10:33:56 -07:00
parent 4e2d22a71d
commit aac6731f2c
6856 changed files with 141342 additions and 21127 deletions

View file

@ -0,0 +1 @@
--- {}

View file

@ -1,8 +1,9 @@
import system'routines.
import system'routines;
import extensions;
public program =
[
var functions := Array new(10); populate(:i)<int>( [ ^ i * i ] ).
public program()
{
var functions := Array.allocate(10).populate:(int i => (^ i * i) );
functions forEach(:func) [ console writeLine(func()). ].
].
functions.forEach:(func) { console.printLine(func()) }
}

View file

@ -0,0 +1,16 @@
use Collection.Generic;
class Capture {
function : Main(args : String[]) ~ Nil {
funcs := Vector->New()<FuncHolder<IntHolder> >;
for(i := 0; i < 10; i += 1;) {
funcs->AddBack(FuncHolder->New(\() ~ IntHolder : () => i * i)<IntHolder>);
};
each(i : funcs) {
func := funcs->Get(i)->Get()<IntHolder>;
func()->Get()->PrintLine();
};
}
}