begin quoting Tom Gal as of Thu, Jan 24, 2008 at 09:43:23AM -0800: > Unfortunately, first of all it's impossible to computationally detect an > infinite loop.
Impossible to *reliably* detect an infinite loop. You can't catch all, but you can catch some. > It's loosely the Halting Problem solved by Turing back in the > old days. Turing solved the Halting Problem? In your universe, did he also prove NP = P? ;-) > Also recursion just uses the system stack as a data structure, so iteration > typically is not only faster in implementation due to less pushing and > popping of stack frames (of course if you use a smarter data structure) on > the runtime stack, but can typically use less memory because of all of the > unnecessary overhead of a function call tree managed in an ultra-generic > fashion by your computer. [Optimized] Tail recursion doesn't push a new stack frame for just this reason. Iteration is fast. Recursion is elegant. [chop] And why the top-post? It just wastes space and time. LEARN TO TRIM. -- If I find nothing of yours when to the bottom I read I may call upon the ASCII gods to on your soul feed. Stewart Stremler -- [email protected] http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg
