Find limit of recursion: Difference between revisions

Content deleted Content added
Added Scheme
Added Oz.
Line 142: Line 142:


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).
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|Oz}}==
{{trans|Scheme}}

Oz supports an unbounded number of tail calls. So the following code can run forever with constant memory use (although the space used to represent <code>Number</code> will slowly increase):
<lang oz>declare
proc {Recurse Number}
{Show Number}
{Recurse Number+1}
end
in
{Recurse 1}</lang>

With non-tail recursive functions, the number of recursions is only limited by the available memory.


=={{header|PureBasic}}==
=={{header|PureBasic}}==