2011-04-13 13:21:06 -07:00
|
|
|
|
|
|
|
|
2011-06-15 11:19:50 -07:00
|
|
|
fn mk() -> int { ret 1; }
|
2011-04-13 13:21:06 -07:00
|
|
|
|
2011-06-15 11:19:50 -07:00
|
|
|
fn chk(&int a) { log a; assert (a == 1); }
|
|
|
|
|
|
|
|
fn apply[T](fn() -> T produce, fn(&T) consume) { consume(produce()); }
|
2011-04-13 13:21:06 -07:00
|
|
|
|
|
|
|
fn main() {
|
2011-06-15 11:19:50 -07:00
|
|
|
let fn() -> int produce = mk;
|
|
|
|
let fn(&int) consume = chk;
|
|
|
|
apply[int](produce, consume);
|
|
|
|
}
|