Jump to content

Find limit of recursion: Difference between revisions

Logo: no limit
(Forth)
(Logo: no limit)
Line 149:
 
Note also, that ^: can be used for induction, and does not have stack size limits, though it does require that the function involved is a mathematical function -- and this is not always the case (for example, Markov processes typically use non-functions).
 
=={{header|Logo}}==
Like Scheme, Logo guarantees tail call elimination, so recursion is effectively unbounded. You can catch a user interrupt though to see how deep you could go.
 
<lang logo>make "depth 0
 
to recurse
make "depth :depth + 1
recurse
end
 
catch "ERROR [recurse]
; hit control-C after waiting a while
print error ; 16 Stopping... recurse [make "depth :depth + 1]
(print [Depth reached:] :depth) ; some arbitrarily large number</lang>
 
=={{header|Oz}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.