Nice Tony!
I had heard a rumor that most code houses do not allow recursive functions in production code for fear of a stack overflow,
anyone know if this is true? Obviously though, recursion is sometimes the most elegant way to solve certain tasks.
Hi Dan.
The decision is usually linked to praticle use, e.g., if you have a folder
structure deep enough to overflow the stack in a simple case like that,
you'd be better off firing the IT management that allowed things to get
that way, and give the programmer that wrote the recursive function
that merely exposed the larger problem a raise and a promotion
I use recursion quite a bit, but in all cases I am more than confident
it will never go deep enough to use up the stack, and I have yet to
see it happen.
Also, there are quite a few compilers that know how to optimize
properly-tail-recursive code, and output iterative code that does
the job. I don't believe that C# does it, but most LISP and Scheme
compilers do, so an unconditional mandate banning recursion with
no regards to what tools are used or whether they can optimize
tail-recusive, seems a bit silly.