| replying again.
I could have saved myself some typing. You describe it in much more detail than me.
Just to point out one thing. Your "which by some definitions _might_ constitute recursion" is probably redundant, since I'm pretty sure that this would still be recursive by the proper definition.
Consider that recursion is based on the mathematical concept of recursive function definitions, so I could define factorial in two ways. The first is:
f(k) = PI[i = 1 .. k](i)
Which is easily recognizable as the closed-form (iterative) definition.
Alternatively, there is:
f(k) = f(k - 1) * k if k > 0
= 1 if k = 0
Which is easily recognizable as the recursive definition. It doesn't much matter if I write the second function as a function that calls itself, or one that uses a stack or queue to maintain the factors so far; I'm still using a recursive function.
This is probably just a nitpick, but it's an important distinction, I think, since otherwise, whether you are writing a recursive function or an iterative one can become a property of the language you are using. |