Zipper isn't tested for immutability

The zipper exercise is framed as “a functional view of a data structure”, which implies operations return a new structure rather than modifying the original. But nothing in the C# test suite checks that: an implementation that adds setters to BinTree and mutates in place passes all 14 tests. A fair number of community solutions do exactly that, and in doing so never encounter the structural sharing that’s the point of a zipper.

The Go track covers this with hand-added TestImmutableSetValue / TestImmutableSetRight / TestFocusDoesNotChangeNodes tests.

Would a PR adding these to the C# tests too be appreciated?
Python/JS/Ruby don’t test it either, but I’m not qualified for those languages and those exercises do not hand the user the BinTree data structure like Go and C# do.

Absolutely! We do use a generators setup to regenerate exercises. See csharp/exercises/practice/zipper/.meta/Generator.tpl at main · exercism/csharp · GitHub for the generator template file and csharp/docs/GENERATORS.md at main · exercism/csharp · GitHub for information on how to work with it.

1 Like