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

Satellite requires unnatural edge case checking #1259

Open
DanRyba253 opened this issue May 27, 2024 · 1 comment
Open

Satellite requires unnatural edge case checking #1259

DanRyba253 opened this issue May 27, 2024 · 1 comment

Comments

@DanRyba253
Copy link

I feel like the first test of "satellite"

Case { description = "Empty tree"
     , preorder    = ""
     , inorder     = ""
     , expected    = Nothing
     }

should be

Case { description = "Empty tree"
     , preorder    = ""
     , inorder     = ""
     , expected    = Just Leaf
     }

Reasons:

  1. the BinaryTree type already supports empty trees, so expecting Nothing is redundant
  2. empty list is a valid inorder and preorder traversal for an empty tree, so expecting Nothing is misleading, as it indicates that an error has occured.
  3. A recursive implementation of treeFromTraversals naturally outputs Just Leaf on empty inputs, thus, satisfying the tests requires an awkward wrapper function.
Copy link

Hello. Thanks for opening an issue on Exercism 🙂

At Exercism we use our Community Forum, not GitHub issues, as the primary place for discussion. That allows maintainers and contributors from across Exercism's ecosystem to discuss your problems/ideas/suggestions without them having to subscribe to hundreds of repositories.

This issue will be automatically closed. Please use this link%20the%20%60BinaryTree%60%20type%20already%20supports%20empty%20trees,%20so%20expecting%20%60Nothing%60%20is%20redundant%0D%0A2)%20empty%20list%20is%20a%20valid%20inorder%20and%20preorder%20traversal%20for%20an%20empty%20tree,%20so%20expecting%20%60Nothing%60%20is%20misleading,%20as%20it%20indicates%20that%20an%20error%20has%20occured.%0D%0A3)%20A%20recursive%20implementation%20of%20%60treeFromTraversals%60%20naturally%20outputs%20%60Just%20Leaf%60%20on%20empty%20inputs,%20thus,%20satisfying%20the%20tests%20requires%20an%20awkward%20wrapper%20function.&category=haskell ) to copy your GitHub Issue into a new topic on the forum, where we look forward to chatting with you!

If you're interested in learning more about this auto-responder, please read this blog post.

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