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

zipper: description describes rose trees. Should it? #1317

Closed
petertseng opened this issue Sep 4, 2018 · 8 comments
Closed

zipper: description describes rose trees. Should it? #1317

petertseng opened this issue Sep 4, 2018 · 8 comments

Comments

@petertseng
Copy link
Member

See how https://github.com/exercism/problem-specifications/blob/master/exercises/zipper/description.md describes possible zipper operations for a rose tree, but the first sentence tells us to implement a zipper for a binary tree. also note that https://github.com/exercism/problem-specifications/blob/master/exercises/zipper/canonical-data.json tells us to use binary trees

Thus, a potential improvement to the description could be to replace the rose trees operations with binary tree operations. This would make the README more applicable to the problem being asked. However, is there a disadvantage of doing that? Does it decrease learning in some way if the possible operations of the zipper are described in advance?

@petertseng
Copy link
Member Author

Looks like the individual who asked about it in exercism/haskell#546 never opened an issue in problem-specifications. And now it became my turn to do so.

@macintux
Copy link
Contributor

macintux commented Jan 28, 2019

There's a related problem with the exercise. It's not an insurmountable challenge by any means, but it does make it more difficult for someone who is attempting to solve the problem by understanding Huet's paper.

The paper describes go_left and go_right operations as moving left or right laterally within a list of children. The Exercism tests use left and right operations to navigate to the left and right children. From reviewing the tests this appears to almost be irrelevant, except by the dead_end test that expects an empty response when navigating to an empty child.

It's effectively impossible to implement the original Huet algorithm out of the box to solve the exercise because this concept doesn't apply to a rose tree (at least in this case, because the other child does exist; it would be fine if the test were attempting to navigate to either child of a leaf node).

Anyway, the fact that the Huet zipper algorithm doesn't solve this is probably not terribly important, but the naming of left and right combined with the README's confusion over the type of tree doesn't help with comprehension, and I'm wondering how many people are implementing a real zipper data structure vs some other type of tree.

Update: it's worth noting that I don't know OCaml and my CS days are long behind me, so it's possible I'm misinterpreting the Huet paper's use of trees. Take the above complaint with a few grains of salt.

Update 2: I did belatedly realize there is an obvious way to cope with the dead_end test while retaining the original algorithm (by storing the two values as two items of a list, including some indicator for the empty value, and juggling appropriately), so meh, maybe this is all irrelevant. Still confusing but perhaps that just adds to the educational experience.

@martinfreedman
Copy link

Just my two cents worth. I was looking forward to a rose tree exercise but this Zipper exercise is not it. I do agree in making it clear this is writing a Zipper for a binary tree. Are there are proper rose tree exercises apart from the refactoring exercise?

@SleeplessByte
Copy link
Member

Just my two cents worth. I was looking forward to a rose tree exercise but this Zipper exercise is not it. I do agree in making it clear this is writing a Zipper for a binary tree. Are there are proper rose tree exercises apart from the refactoring exercise?

I don't think we have one, but that means it can be added!

@ErikSchierboom
Copy link
Member

Yes, sounds look a great new exercise!

@martinfreedman
Copy link

martinfreedman commented Jan 5, 2021

This has C#, F# and Haskell examples.

@Lattay
Copy link

Lattay commented Nov 4, 2023

Hi,

The zipper exercise description is pretty offputting as it contains no instructions and talk about a completly different data structure.
Can we rewrite that to make it informative?
Can I just write a description and make a PR here for it to be reflected on all repos?

@IsaacG
Copy link
Member

IsaacG commented Nov 4, 2023

This exercise is being discussed on the forum. As such, I am closing out this issue to avoid duplicated discussions.

@IsaacG IsaacG closed this as completed Nov 4, 2023
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

7 participants