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

I find writing recursive code is often very short and easier to read and show intent than the same code written non recursively.


Additionally, in languages with good, convenient support for functional programming like Haskell and Scala, I find that I tend to write lots of short functions, often making use of higher-order functions to decompose code into really simple, and potentially reusable, pieces. And like you say, this really helps to show intent. The same sort of thing, in fact, that object-oriented programmers try to do with design patterns such as the Strategy pattern - but with fewer lines of code.




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

Search: