How can I change the maximum call depth?

The following code throws an error message:

#let fib(n) = if n <= 1 { n } else { fib(n - 1) + fib(n - 2) }

#fib(90)

The error is: error: maximum function call depth exceeded

How can I change the maximum call depth to e.g. 1000?

Hello,

You can re-compile typst by modifying this const typst/crates/typst-library/src/engine.rs at main · typst/typst · GitHub.
Otherwise, you can always try the iterative fibonacci.

1 Like