Anonymous user
Find limit of recursion: Difference between revisions
add gnuplot
(add emacs lisp) |
(add gnuplot) |
||
Line 571:
# No limit (may crash GAP if recursion is not controlled) :
SetRecursionTrapInterval(0);</lang>
=={{header|gnuplot}}==
<lang gnuplot># Put this in a file recurse.gnuplot and run as
# gnuplot -e try=1 recurse.gnuplot
# probe by 1 up to 1000, then by 1% increases
try=(try<1000 ? try+1 : try*1.01)
recurse(n) = (n > 0 ? recurse(n-1) : 'ok')
print "try recurse ", try
print recurse(try)
reread</lang>
Gnuplot 4.6 has a builtin <code>STACK_DEPTH</code> limit of 250, giving
<pre>try recurse 251
"/so/rosetta/recurse.gnuplot", line 2499: recursion depth limit exceeded</pre>
Gnuplot 4.4 and earlier has no limit except the C stack, giving a segv or whatever eventually.
=={{header|Go}}==
Go features stacks that grow as needed, so I expected a rather large recursion limit. I used this simple program, that prints every 1000 levels:
|