4 ms·
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 ar
by chongli 5y ago
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.
- tester756 5y ago>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
- deleted 5y ago[deleted]
- garethrowlands 5y agoTrue enough but worth noting that a good tree should also have map/filter/fold-like operations.