Skip to content

Improve traverse tree #81

@stdex

Description

@stdex

As I can see, visitors return array of nodes, and how I should use it after I get it?
Proposed I should reiterate this array?

  1. It looks like visit method should yield value and lazy step by tree when I iterate by yield, otherwise the whole point of traversing the tree is lost (because it turns out a double tree walk).
  2. Another solution should be call visit method with callback param (anonymous function).
    E.g. in other libs:
    https://github.com/slince/tree-samples/blob/master/tests/Traversal/BFSTest.php#L17
    https://github.com/jorpo-co/tree/blob/master/tests/Traversal/BreadthFirstTraversalTest.php#L36

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions