2010-06-23 23:03:09 -05:00
|
|
|
|
|
|
|
|
2011-06-15 13:19:50 -05:00
|
|
|
|
|
|
|
// -*- rust -*-
|
|
|
|
fn ho(fn(int) -> int f) -> int { let int n = f(3); ret n; }
|
|
|
|
|
|
|
|
fn direct(int x) -> int { ret x + 1; }
|
2010-06-23 23:03:09 -05:00
|
|
|
|
|
|
|
fn main() {
|
2011-06-15 13:19:50 -05:00
|
|
|
let int a =
|
|
|
|
direct(3); // direct
|
|
|
|
//let int b = ho(direct); // indirect unbound
|
|
|
|
|
|
|
|
let int c =
|
|
|
|
ho(bind direct(_)); // indirect bound
|
|
|
|
//assert (a == b);
|
|
|
|
//assert (b == c);
|
2010-06-23 23:03:09 -05:00
|
|
|
|
2011-06-15 13:19:50 -05:00
|
|
|
}
|