rust/src/test/run-pass/tail-cps.rs
Lindsey Kuper b8880e3254 Remove be keyword.
Closes #2227.
2012-05-15 10:41:14 -07:00

20 lines
454 B
Rust

// -*- rust -*-
fn checktrue(rs: bool) -> bool { assert (rs); ret true; }
fn main() { let k = checktrue; evenk(42, k); oddk(45, k); }
fn evenk(n: int, k: native fn(bool) -> bool) -> bool {
#debug("evenk");
log(debug, n);
if n == 0 { ret k(true); } else { ret oddk(n - 1, k); }
}
fn oddk(n: int, k: native fn(bool) -> bool) -> bool {
#debug("oddk");
log(debug, n);
if n == 0 { ret k(false); } else { ret evenk(n - 1, k); }
}