Recursive Functions (58)

3 Name: #!/usr/bin/anonymous : 2008-02-12 13:26 ID:Heaven

Forcing recursion where iteration is more logical is silly, and is one reason I'm not too fond of functional programming.

No, what >>1 wants to do is study recursive functions in actual use. Certain algorithms become much easier when implemented recursively, just as others are much easier when implemented iteratively. So to learn properly about recursion, study those cases where it is useful.

Of course, now that I said that I can't think of any good and simple examples off the top of my head. Most of the basic examples of recursion tend to be things which work better iteratively, which makes the whole thing pretty pointless.

I guess traversing trees might be a decent example, but I don't have anything good to link to. So I'll leave the specifics to someone else.

This thread has been closed. You cannot post in this thread any longer.