Created
October 10, 2016 06:28
-
-
Save dahu/66989ec585654726b97bb4124deb9713 to your computer and use it in GitHub Desktop.
Ackerman function causes stack overflow in Red (and not Rebol)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Red [] | |
; https://rosettacode.org/wiki/Ackermann_function | |
ack: func [m n] [ | |
case [ | |
0 = m [n + 1] | |
0 = n [ack m - 1 1] | |
true [ack m - 1 ack m n - 1] | |
] | |
] | |
; | |
repeat m 3 [ | |
repeat n 6 [ | |
print ack m n | |
] | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment