It can still be non-obvious with an optimizing compiler, or with non-Lisp.
I don't see the point in having beginning students think about tail call optimized recursion vs normal recursion unless they're going through SICP. In the end it can totally be a compiler thing. For instance, GCC can optimize this:
int factorial(int x) {
if (x > 1) return x * factorial(x-1);
else return 1;
}
into this:
int factorial(int x) {
int result = 1;
while (x > 1) result *= x--;
return result;
}
I don't see the point in having beginning students think about tail call optimized recursion vs normal recursion unless they're going through SICP. In the end it can totally be a compiler thing. For instance, GCC can optimize this:
into this: (http://ridiculousfish.com/blog/posts/will-it-optimize.html)