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

Map explicitly says what it does. A loop forces you to carefully (re)read it to see whether it ever skips an element, appends more than one result, or doesn’t propagate an error, because findFirst, findLast, findAll, filter, map, flatMap, and reduce all look very similar as loops.

If you need a loop to work around a poor optimizer, at least use a preprocessor to generate it. Devs are expensive.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

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

Search: