7 kyu
You Shall Not Parse!
216user578387
Loading description...
Parsing
Algorithms
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
Description is not clear about the criterions. Apparently we should accept leading zeros, that's not obvious and some languages reject this. We must also reject float shaped strings. This should be stated. Moreover tests logs are not informative enough: Expected False but got True, they should give the input. As far as I know one cannot print stuff in Haskell.
I am new to Haskell, I want to print some of the input strings so I know what test cases I am failing. How can I do this?
You've probably figured this out by now, but in case others are reading, you can print out strings for debugging using Debug.Trace however the downside is that prints will not be grouped with the specific test assertions, so figuring out specifically which input caused the fail can still be difficult.
+1 for "throw a gigantic paddy".
This comment has been hidden.
Ah, how true! Thanks!
"-" is supposed to parse to a valid integer according to the reference implementation. However, this isn't specified, and is at least an edge case, if not a bug in the reference implementation.
Fixed. Next time post this as an issue.
Your tests are not checking that "-" is a invalid number.
Added, thanks!
I suggest adding a test case with something like "--123" - assuming that isn't meant to parse a simple recursive solution might trip up over that. (And if it is meant to parse my solution definitely will).
And while we're at it, lets check arbitrary strings
Added. Thanks, both of you!
This comment has been hidden.
This comment has been hidden.