Search code examples
algorithmlispstack-overflow

Lisp stack overflow bound


I really need an advice. I have a function that have big number of recursive calls. Actually i need it. And algorithm is correct it works in C but in lisp there is a problem because of stack overflow. What should i do to solve it? How can i change algorithm to be able to work in lisp?


Solution

  • You have three options:

    1. Rewrite the algorithm to be tail-recursive or, equivalently, iterative
    2. Change the algorithm all together
    3. Increase the lisp's stack size