4 ms·
Re naturally recursive - it depends on your application domain. If you work with trees all day long, such as in a compiler, templating engine, scene graph, etc.
by barrkel 17y ago
Re naturally recursive - it depends on your application domain. If you work with trees all day long, such as in a compiler, templating engine, scene graph, etc. recursion is almost more common than looping.
- Periodic 17y agoHonestly, I feel like recursion is the natural way to express transformations on any nexted data structure (like a list, tree, or graph). I think the major reason that many people don't see these data structures often is because some languages make recursion harder than iteration, so they stick with iteration across arrays and `for` loops. Recursion is really a natural way to express almost any repeated operation on a computer.