Created
October 26, 2012 17:36
-
-
Save keigoi/3960129 to your computer and use it in GitHub Desktop.
Rust tail call test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// use tail-call only, but stack overflow occur | |
fn recur(i : int) { | |
if i!=0 { | |
recur(i-1); | |
} | |
} | |
fn main() { | |
recur(1000000); | |
} | |
// Result ---- | |
// rust: task 7f99a2d00220 ran out of stack | |
// rust: domain main @0x7f99a3800010 root task failed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
rust -O tailcall.rs will do TCO!!