Initial import
This commit is contained in:
commit
405b86068e
324 changed files with 163599 additions and 0 deletions
18
tests/tack.nim
Executable file
18
tests/tack.nim
Executable file
|
|
@ -0,0 +1,18 @@
|
|||
# the Ackermann function
|
||||
|
||||
import
|
||||
io
|
||||
|
||||
proc ack(x, y: int): int =
|
||||
if x != 0:
|
||||
if y != 0:
|
||||
return ack(x-1, ack(x, y-1))
|
||||
return ack(x-1, 1)
|
||||
else:
|
||||
return y + 1
|
||||
# if x == 0: return y + 1
|
||||
# elif y == 0: return ack(x-1, 1)
|
||||
# else: return ack(x-1, ack(x, y-1))
|
||||
|
||||
# echo(ack(0, 0))
|
||||
write(stdout, ack(3, 4)) #OUT 125
|
||||
Loading…
Add table
Add a link
Reference in a new issue