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

Writing code out by hand

Name: Anonymous 2009-11-01 2:13

I started teaching myself programming and I fucking love it.. So I decided well I might aswell take a course at university so that I have a really strong foundation to build on myself. It's such bullshit. They keep taking points off my assignment and giving me comments like "recursion hasn't been covered in class yet". SO fucking what? Now they want me to write an exam and write my code out by hand? Is that even possible? Are there ever any 'real world' scenarios where you would ever need to do that?

Name: >>20 2009-11-01 11:48

>>21
Well, that's kind of stupid. What I meant is that a lot of algorithms are easier to express recursively: traversing/searching/modifying trees/graphs, backtracking and other search algorithms. While I understand that some people like to use recursion for looping in languages supporting TCO(as shown in SICP), I'm not one to use it like that too often if the language has good iteration constructs. Bottom line is that recursion should be used when it's the most clear way to express an algorithm. Using (tail) recursion for iteration  in languages with decent iteration constructs is usually mental masturbation. Using non-tail recursive versions for iteration is even worse since you're using stack space.

tl;dr: Use whatever fits your problem best.

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