Just another update
This commit is contained in:
parent
a25938f123
commit
00a190b0a6
6591 changed files with 94363 additions and 23227 deletions
15
Task/Ackermann-function/Rust/ackermann-function-1.rust
Normal file
15
Task/Ackermann-function/Rust/ackermann-function-1.rust
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
// works for Rust 0.9
|
||||
fn main() {
|
||||
let a: int = ack(3, 4); // 125
|
||||
println!("{}", a.to_str());
|
||||
}
|
||||
|
||||
fn ack(m: int, n: int) -> int {
|
||||
if m == 0 {
|
||||
n + 1
|
||||
} else if n == 0 {
|
||||
ack(m - 1, 1)
|
||||
} else {
|
||||
ack(m - 1, ack(m, n - 1))
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue