~garritfra/antimony

antimony/examples/ackermann.sb -rw-r--r-- 276 bytes
36db9aecGarrit Franke remove accidental test file 1 year, 1 month ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
fn main() {
    let m = 3
    let n = 3
    println(ackermann(m, n))
}

fn ackermann(m: int, n: int): int {
    if m == 0 {
        return n + 1
    } else if n == 0 {
        return ackermann(m - 1, 1)
    } else {
        return ackermann(m - 1, ackermann(m, n - 1))
    }
}