I don't really have much to say about this proposal, other than to point out that forEach
and map
can be implemented using recursion when navigating a tree structure, which is probably more efficient than an iterator-based implementation.
The BTree library does exactly this. Using the iterator involves maintaining the current tree path using arrays.