>>From: Tracy R Reed <[EMAIL PROTECTED]>
>>Summary: Anywhere you would iterate you can also recurse. They are
>>computationally equivalent. And once you get your head around it
>> recursion
>>is just as intuitive. But it usually results in less code and fewer
>>opportunities for bugs among other nice properties.
>>
> If you have to get your head around it, by definition its not intuitive.
> And I've seen far more bugs in recursive versions of algorithms than the
> equivalent iterative ones.

I haven't met anybody yet who can do iterative programming intuitively
either.  When you first learn to program, it takes a while before you
really 'get it'.

It's the same thing with recursive programming.  When I was in college, I
took a class  where we had to work a lot with Scheme.  It took me a little
while to 'wrap my head around it', but by the end of that class recursion
was second nature.  Even in a procedural language like Java or C, I would
often think of recursive algorithms first, and often it was only after the
fact that I would belatedly realized that there was an iterative solution
as well.

I still use lots of recursion in my code, since it often does make things
simpler and more powerful.

-- Mark Lewis

-- 
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg

Reply via email to