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

I would argue that for loops are imperative, map/fold/etc are more declarative. That leads to various benefits such as less code, fewer bugs, fewer off-by-one errors.

And, man, tail recursion in a language with function head pattern matching (ML family, Erlang) is so much easier to read than any complicated for loop.

(Update: realized afterwards that "foreach" isn't quite the same as "for", but the larger point still stands, mostly.)



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

Search: