recursionDepth -- the current recursion depth

Synopsis

• Usage:
recursionDepth()
• Outputs:
• an integer, the current depth of recursion in the interpreter

Description

 i1 : recursionDepth() o1 = 14 i2 : f = x -> recursionDepth() o2 = f o2 : FunctionClosure i3 : f() o3 = 15 i4 : g = x -> f() o4 = g o4 : FunctionClosure i5 : g() o5 = 16
Tail recursion optimization may be in effect, so there the answer may not always be what you expect.
 i6 : r = i -> if i == 100 then recursionDepth() else r(i+1) o6 = r o6 : FunctionClosure i7 : r 0 o7 = 15