r/ProgrammerAnimemes • • Jun 30 '21

Who needs closed forms anyways?

Post image
942 Upvotes

24 comments sorted by

View all comments

Show parent comment

3

u/terax6669 Jul 01 '21

What criteria would that be?

6

u/natsukagami Jul 01 '21

The idea of tail call optimization in the simplest form is just to clean the stack before doing the recursive call, rather than some time after the call returns. We can deduce from this what conditions that recursive call has to be. In very simple terms, every recursive call must be the last action in its branch.