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

You wouldn't use map or reduce, you'd just use recursion with an accumulator.

If you absolutely insist on map/reduce, you can just use reduce, where your binary function returns whichever object has a longer full name.



Well, reduce is a recursion with an accumulator. Did you had something special in mind?


In hindsight the second solution was obvious :) But can you explain your ideal solution more? Is it something that can be accomplished in Javascript?


Why would you write mind-boggling recursion by hand, and not use a nice combinator that comes pre-debugged?


Because I had a brain fart and though "reduce" was "scan", and I didn't want to initialize an array.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

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

Search: