On Tuesday 05 May 2009 04:25:49 am Carl Banks wrote: > Iteration should be used instead of recursion anywhere a tail- > recursive algorithm is possible. Recursion should be used only when > tail-recursion is not possible.
Why? Is it because most languages suck at recursion (specially python, as this thread shows)? If that's the reason, I think you have it backwards... Turning a tail-recursion into an iteration should be the compiler's job, not mine. An algorithm, any algorithm, should be written in the way that is easier to read, unless the language wont allow that easier implementation to be efficient enough. Programming languages suck, but that shouldn't mean that we can't hope to improve them. -- Luis Zarrabeitia (aka Kyrie) Fac. de Matemática y Computación, UH. http://profesores.matcom.uh.cu/~kyrie -- http://mail.python.org/mailman/listinfo/python-list
