[REBOL] Depth of recursion stack
From: larry::ecotope::com at: 6-Aug-2000 18:55
Hi all
The use of recursive functions in REBOL is limited by the depth of the
recursion stack. Here is a simple test of the depth using Core 2.4 on
Win98. The len? function gives the same result as the built-in length?
function, but uses recursion.
>> len?: func [s [series!]][either empty? :s [0][1 + len? s: next :s]]
>> len? array/initial 1115 1
== 1115
>> len? array/initial 1116 1
** Internal Error: Stack overflow.
** Where: either empty? :s [0] [1 + len? s: next :s]
>> len? array/initial 1115 1
== 1115
Apparently the stack allows for 1115 recursive calls.
Comments? Other examples?
-Larry
Librarian comment
The precise depth appears to depend on plaform and version.
View 1.3 has a depth in excess of 5000
This script has some standard REBOL stress tests.