Find limit of recursion: Difference between revisions
Content added Content deleted
(Nimrod -> Nim) |
|||
Line 1,196: | Line 1,196: | ||
</pre> |
</pre> |
||
=={{header| |
=={{header|Nim}}== |
||
<lang |
<lang nim>proc recurse(i): int = |
||
echo i |
echo i |
||
recurse(i+1) |
recurse(i+1) |
||
echo recurse(0)</lang> |
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: |
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> |
<pre>nim c --debuginfo --lineDir:on recursionlimit.nim</pre> |
||
=={{header|OCaml}}== |
=={{header|OCaml}}== |