Hacker Timesnew | past | comments | ask | show | jobs | submitlogin

"Many students struggle with the idea of recursion..."

I still remember one of the worst bugs I'd ever introduced (in terms of pain to me). I was maybe 2-3 years out of my bachelors, and I thought recursion was so nifty that I'd use it where ever I could. I was coding C++, at the time. And, I got the dreaded 2am call after all of the production servers went down hard. Like terminate and corrupt data hard.

Lesson learned: it's good to know recursion, but it's also good to know maximum stack sizes.



There's also thunk/trampolining continuation style to convert recursion easily into something that is not stack limited. http://nathansuniversity.com/cont.html


What problem were you trying to solve with recursion?


That and tail-call optimisation :)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: