You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, awesome work guys, very useful and helpful.
Just a comment about semantics if I may.
Your generic "Visitor" is more like an "Iterator".
The "Visitor" pattern usually doesn't decide how to traverse the tree, that's what an Iterator does.
Yes, your visitors also define an output, but you might wanna separate the two concerns: turn the PreOrder and PostOrder visitors into iterators.
The iterator returns the nodes one by one, and then you can pass them to a visitor that does something on them.
That way you'd decouple the traverse algorithm from whatever operation/processing the visitor wants to do.
Makes sense?
The text was updated successfully, but these errors were encountered:
First of all, awesome work guys, very useful and helpful.
Just a comment about semantics if I may.
Your generic "Visitor" is more like an "Iterator".
The "Visitor" pattern usually doesn't decide how to traverse the tree, that's what an Iterator does.
Yes, your visitors also define an output, but you might wanna separate the two concerns: turn the PreOrder and PostOrder visitors into iterators.
The iterator returns the nodes one by one, and then you can pass them to a visitor that does something on them.
That way you'd decouple the traverse algorithm from whatever operation/processing the visitor wants to do.
Makes sense?
The text was updated successfully, but these errors were encountered: