3 ms·
Looks like the pattern effectively linearizes the hierarchical structure. So you can stream or iterate over the ouput of a visitor run, as the author said. Cou
by kizer 8y ago
Looks like the pattern effectively linearizes the hierarchical structure. So you can stream or iterate over the ouput of a visitor run, as the author said.
Could one just implement an iterator on top of a tree structure? This would be similar but be imperative right rather than declarative as you would not provide a “callback”, but pull out nodes directly.
- rs86 8y agothis is a fairly trivial thing to do in computer science.
- mark_edward 8y agoThis is how all of Rust's iterators and iteration protocol work. Including standard library and other tree structures, graphs, etc.