Get the latest tech news
Programming languages should have a tree traversal primitive
There should be a control flow construct in programming languages that can handle tree-like traversal in a nice way, similar to how for/foreach loops can handle linear traversal.
Well, this is significantly easier and less error prone than implementing recursive functions for every operation you'd want to do on every type of tree, plus all the relevant code ends up in-place and readable. Doesn't for_tree(...) look a lot nicer and simpler and less error prone than needing to implement a recursive function for each operation you would want to do on a tree? On the other hand, "one level deeper" in a tree traversal means checking the validity of multiple times as many leaf nodes as you need to.
Or read this on Hacker News