Skip to content

Commit a8b39cd

Browse files
committed
increased max recursion depth to 3000 (to match python)
1 parent 83e2748 commit a8b39cd

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

evaluator.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"strings"
88
)
99

10-
const MaxRecursionDepth = 1000 // Between 1000 and 2000 is considered to be a reasonable recursion depth for recursive functions
10+
const MaxRecursionDepth = 3000 // Between 1000 and 2000 is considered to be a reasonable recursion depth for recursive functions
1111

1212
type Evaluator struct {
1313
// Keep track of file path that have been imported by the import statement.

example/test.rune

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
factorial = fun(n) {
2-
if n == 0 then 1
2+
if n == 0 then return = 1
33
n * factorial(n - 1)
44
}
5-
println(factorial(5)) # Outputs 120
5+
6+
timeBefore = millis()
7+
factorial(998)
8+
timeAfter = millis()
9+
time = timeAfter - timeBefore
10+
println(time)
611

712
fibonacci = fun(n) {
813
if n <= 1 then return = n

0 commit comments

Comments
 (0)