8000 doctest issue of ListZipper.moveLeftN' · Issue #116 · system-f/fp-course · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

doctest issue of ListZipper.moveLeftN' #116

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

Open
realli opened this issue Feb 12, 2015 9269 · 1 comment
Open

doctest issue of ListZipper.moveLeftN' #116

realli opened this issue Feb 12, 2015 · 1 comment

Comments

@realli
Copy link
realli commented Feb 12, 2015

in the file src/Course/ListZipper.hs, at line 412

-- If the focus cannot be moved, the given number of times, return the value by which it can be moved instead.
-- >>> moveLeftN' (-4) (zipper [5,4,3,2,1] 6 [7,8,9])
-- Left 3

I think the excepted result should be Left -3, what do you think? the Same for moveRightN'

@alexvorobiev
Copy link

I would say that the exercise itself is incomplete. It looks like the test is written to match the official solution. The spec says explicitly "return the value by which it can be moved instead". It doesn't say "in the same direction" (in that case the correct result would indeed be Left -3). So, given that this is moveLeftN', the logical result for that test would be something like Left 1. But in any case Left 3 does not make sense because it assumes the direction to the right but loses the sign.

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
0