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

Generally when you learn recursion you also learn about higher order functions. Most of the use cases of loops get replaced with map/filter/fold. What’s left are typically those “unintuitive” problems that need recursion, such as when you’re dealing with trees.


>What’s left are typically those “unintuitive” problems that need recursion, such as when you’re dealing with trees.

I always prefer to walk thru trees with e.g stack/queue because it's easier to reason about / debug it for me


True enough but worth noting that a good tree should also have map/filter/fold-like operations.




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

Search: