-
-
Notifications
You must be signed in to change notification settings - Fork 196
Hamming: Add a test case to avoid wrong recursion solution #796
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
Conversation
Thanks a lot for your pull request! And you are quite right, this test case is missing. If you don't mind, I would like to propagate this test case to the central Exercism repository for test cases shared across language tracks, since I imagine this case may trigger at least other functional languages. Before this can happen, I just noticed that the Hamming exercise is one version bump behind on the Haskell track. I've bumped the Hamming test suite version to 2.2.0 in #797, so that you don't also have to fix this.
I'll merge this PR once the canonical data is merged and the version in package.yaml reflects 2.3.0.10. :-) |
This solution will pass all the current test but fail on the new one: ``` module Hamming (distance) where distance :: String -> String -> Maybe Int distance [] [] = Just 0 distance (x:xs) (y:ys) | length(xs) /= length(ys) = Nothing | x /= y = fmap (1 + ) (distance xs ys) | x == y = distance xs ys ```
Update test version
Hello, I did all 4 points you said and request a new pull request. Please tell me if you notice anything wrong. |
Add an extra test case about one empty strand based on the discussion in exercism/haskell#796 to avoid wrong recursion solution.
@sshine Is this PR ok to merge now or do we still need some changes? |
@tqa236: We're good. Thanks a lot, and sorry for the late response. |
This solution will pass all the current test cases but fail on the new one: