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-07-27 14:19:39 +02:00
|
|
|
fn chk(a: &int) { log a; assert (a == 1); }
|
2011-06-15 11:19:50 -07:00
|
|
|
|
2011-07-27 14:19:39 +02:00
|
|
|
fn apply[T](produce: fn() -> T , consume: fn(&T) ) { consume(produce()); }
|
2011-04-13 13:21:06 -07:00
|
|
|
|
|
|
|
fn main() {
|
2011-07-27 14:19:39 +02:00
|
|
|
let produce: fn() -> int = mk;
|
|
|
|
let consume: fn(&int) = chk;
|
2011-06-15 11:19:50 -07:00
|
|
|
apply[int](produce, consume);
|
|
|
|
}
|