Find limit of recursion: Difference between revisions

Content added Content deleted
(Initial implementation.)
Line 57: Line 57:
<lang algol68>PROC recurse = VOID : recurse; recurse</lang>
<lang algol68>PROC recurse = VOID : recurse; recurse</lang>
For what it's worth this one-liner running under Algol68 Genie and 64-bit Linux reaches a depth of 3535 with the shell's default stack size of 8Mbytes and 28672 when set to 64Mbytes,
For what it's worth this one-liner running under Algol68 Genie and 64-bit Linux reaches a depth of 3535 with the shell's default stack size of 8Mbytes and 28672 when set to 64Mbytes,
as shown by the following output. From this we can deduce that Genie does not implement tail recursion. The --trace option to a68g prints a stack trace when the program crashes; the first two commands indicate the format of the trace, the third counts the depth of recursion with the default stack size and the fourth shows the result of quadrupling the size of the stack.
as shown by the following output. From this we can deduce that Genie does not implement tail recursion. The --trace option to a68g prints a stack trace when the program crashes; the first two commands indicate the format of the trace, the third counts the depth of recursion with the default stack size and the fourth shows the result of octupling the size of the stack.
{{Out}}
{{Out}}
<pre>
<pre>