2011-07-27 18:24:00 -05:00
|
|
|
fn add(i: int, j: int) -> int { ret i + j; }
|
2012-02-07 08:37:08 -06:00
|
|
|
fn binder(n: int) -> fn@() -> int { let f = add(n, _); ret bind f(2); }
|
2011-07-27 18:24:00 -05:00
|
|
|
fn main() {
|
|
|
|
binder(5);
|
|
|
|
let f = binder(1);
|
2011-08-19 17:16:48 -05:00
|
|
|
assert (f() == 3);
|
|
|
|
assert (binder(8)() == 10);
|
2011-07-27 18:24:00 -05:00
|
|
|
}
|