diff options
Diffstat (limited to 'ack.kpl')
| -rw-r--r-- | ack.kpl | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -0,0 +1,14 @@ + +// Ackerman Function Example + +`export ack : `{[I64 m; I64 n] + ? |(m < 0; n < 0) { `return.error $ "m And n Cannot Be Negative" } + ack_native : `{[I64 m; I64 n] + ? { + m = 0 { n + 1 } + &(m > 0; n = 0) { ack_native `call (m - 1; 1) } + { ack_native `call (m - 1; ack_native `call (m; n - 1)) } + } + } + ack_native `call (m; n) +} |
