Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Recursion is cancer

Name: Anonymous 2013-09-22 11:32

It obfuscates the code and impedes debugging.
Its slower and has to rely on compiler optimizations.
I've rewritten many such recursive functions and there always was a speedup and a better looking code.

Name: Anonymous 2013-09-22 11:50

In some cases it's faster and reads better. Rarely though.

Name: Anonymous 2013-09-22 11:54

Please post some comparisons, I find loops to come out bad.

Name: Anonymous 2013-09-22 16:42

who gives a shit

Name: Anonymous 2013-09-22 16:45

most of the time, recursion results in fewer lines of code, which is like the most convincing argument to use it.

Name: Anonymous 2013-09-23 0:35

>>1

Name: Anonymous 2013-09-23 1:38

Recursion is fine and very useful.
However, recursion just for the sake of using recursion is something first years do to "impress" their professors.

Name: Anonymous 2013-09-23 2:23

Recursion can be a very useful tool in solving some problems (recursive backtrack algorithms come to mind). For most problems involving iteration though, use a higher order function if it can be applicable.

Name: Anonymous 2013-09-23 2:58

I love organizing code in terms of recursion rather than iterative loops.

Don't change these.
Name: Email:
Entire Thread Thread List