Subj : Re: Are recursive functions ever needed? To : comp.programming From : Aleya Roe Date : Sat Oct 01 2005 07:34 am > Are recursive functions ever needed, i.e. cannot you just replace them > with iterative clauses? Yes, you can always convert recursion to iteration. But it's not always worth the effort since all but the simplest examples of recursion require you to explicitly use a stack to save the algorithm state that would otherwise be saved by making a recursive call. Sometimes the algorithm makes things easier and with a lot of creativity you can figure out how to avoid the stack, but examples like that are rare. > b = func (func (func (a))) That's not really recursion though, unless this statement is inside the definition of func. You're just calling the function three times. That's easy to turn into iteration. .