blob: 8a743eb57b49c615f46a1d27caf6978d2f7d447e (
plain)
1
2
3
4
5
6
7
8
9
|
||defines ackermann's function, beloved of recursion theorists. Example
|| ack 3 3
||should yield 61, after doing a huge amount of recursion. Can only be
||called for small arguments, because the values get so big.
ack 0 n = n+1
ack (m+1) 0 = ack m 1
ack (m+1) (n+1) = ack m (ack (m+1) n)
ack m n = error "ack applied to -ve or fractional arg"
|