Gabriel Sechan wrote:
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.

"just as intuitive" != "intuitive"

If you have to get your head around it, by definition its not intuitive.

Iteration is far from intuitive, IMO. We are *taught* iteration far earlier.

In addition, as I have pointed out. "Recursion" isn't necessarily the win over iteration. It's the existence of "foreach/map/apply/collect" in the language that is the big win.

And I've seen far more bugs in recursive versions of algorithms than the equivalent iterative ones.

IMO, it depends. Certain algorithms lend themselves to iteration and certain algorithms lend themselves to recursion.

People who do "tree" algorithms iteratively often screw them up horribly. People who do multiple action "foreach" recursively often screw them up horribly.

-a

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

Reply via email to