TLDR Web Dev · OPINIONS & ADVICE
PROGRAMMING LANGUAGES SHOULD HAVE A TREE TRAVERSAL PRIMITIVE
Summary from the TLDR Web Dev newsletter
This post proposes a new control flow construct called `for_tree` for programming languages that simplifies tree traversal, similar to how `for` loops handle linear iteration. This construct would accept an initialization, a condition, and a branching rule to recursively traverse tree-like structures, offering a more readable and less error-prone alternative to manual recursive functions. `for_tree` would also enable `break`, `continue`, and a new `prune` statement for more control.