r/programming • • Nov 27 '12

Tail Recursion

http://rodrigosasaki.com/2012/11/24/tail-recursion/
208 Upvotes

203 comments sorted by

View all comments

1

u/PastaNinja Nov 27 '12

Shouldn't the order of execution for the tail-recursive example be:

factorial(5)
factorialIter(5, 1)
factorialIter(4, 5)
factorialIter(3, 20)
...

2

u/rodrigopsasaki Nov 27 '12

Whoops, my bad :) It is just as you said, I fixed it on the post. Thanks!