Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pov: Consider making tests insensitive to child ordering #92

Closed
petertseng opened this issue Feb 9, 2016 · 3 comments
Closed

pov: Consider making tests insensitive to child ordering #92

petertseng opened this issue Feb 9, 2016 · 3 comments

Comments

@petertseng
Copy link
Member

In the pov tests, given a tree that must be reparented on node x, the tests ensure that the former parent of x comes after the former children of x.

I think it would be beneficial if the tests did not care about the ordering of the children, since trees probably don't care about the ordering of their children, and it almost certainly is valid to allow either order in the POV problem.

@kytrinyx
Copy link
Member

Yeah, allowing either ordering would be great.

@petertseng
Copy link
Member Author

Surveying the other languages that implement this exercise.

  • xgo allows any ordering because it only checks for the presence of edges, and sorts the edges before checking presence.
  • xclojure seems to also be sensitive to ordering; IIRC clojure vectors (denoted by []) only compare equal if the elements are in the same order. Though I will note that Clojure, in expecting the former parent comes after the former children in a vector, expresses an ordering that is more likely to be the default choice, since conj onto a vector appends onto the end of the vector [1]. Nevertheless, it could be worth filing an issue for them as well.

[1]: Note that this is the opposite situation as a Clojure list or a Haskell list, both of which conj/cons/(:) onto the front.

@petertseng
Copy link
Member Author

Expanding more on the work required for this track:

This matters when we are reparenting a node that has both a parent and some children. That means the "reparenting kids" and "reparenting cousins" test cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants