Find limit of recursion: Difference between revisions
Content deleted Content added
J: rewrite |
Add Nimrod |
||
Line 1,028: | Line 1,028: | ||
Recursion stopped by java.lang.StackOverflowError |
Recursion stopped by java.lang.StackOverflowError |
||
</pre> |
</pre> |
||
=={{header|Nimrod}}== |
|||
<lang nimrod>proc recurse(i): int = |
|||
echo i |
|||
recurse(i+1) |
|||
echo recurse(0)</lang> |
|||
Compiled without optimizations it would stop after 87317 recursions. With optimizations on recurse is translated into a tail-recursive function, without any recursion limit. Instead of waiting for the 87317 recursions you compile with debuginfo activated and check with gdb: |
|||
<pre>nimrod c --debuginfo --lineDir:on recursionlimit.nim</pre> |
|||
=={{header|OCaml}}== |
=={{header|OCaml}}== |