Find limit of recursion: Difference between revisions

→‎{{header|gnuplot}}: incorporate the "try" initialization in the code rather than command line
(→‎{{header|OCaml}}: make it more readable with some indentation)
(→‎{{header|gnuplot}}: incorporate the "try" initialization in the code rather than command line)
Line 573:
 
=={{header|gnuplot}}==
<lang gnuplot># Put this in a file recursefoo.gnuplot and run as
# gnuplot -e try=1 recursefoo.gnuplot
 
# probe by 1 up to 1000, then by 1% increases
if (! exists("try")) { try=0 }
try=(try<1000 ? try+1 : try*1.01)
 
Line 587 ⟶ 588:
 
<pre>try recurse 251
"/sotmp/rosetta/recursefoo.gnuplot", line 24992760: recursion depth limit exceeded</pre>
 
Gnuplot 4.4 and earlier has no limit except the C stack, giving a segv or whatever eventually.