6 kyu
Decoded String by the Numbers
236 of 347Omnilord
Loading description...
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.
python new test framework is required. updated in this fork
Approved
Use Python new test framework and increase number of random test from 1 to 100.
https://www.codewars.com/kumite/633edfecf98a8200158803d0?sel=633edfecf98a8200158803d0
Superceded by latest fork :(
str
should not be used as argument name in Python.Fixed!
Python translation
.
Haskell:
That may be a description issue really; it could say "backslash followed by a positive number". The JavaScript ( original ) reference solution only recognises numbers that don't start with, or are,
0
, and no testing at all is done with such numbers. I did the Haskell reference solution according to "positive", I did not modify the description ( no I don't know why I didn't .. ), but I did include fixed and possibly random tests for this behaviour.Ah! I did change it, but it got reverted when the Julia translation was forked for merge conflict. OK, changing the description again.
That's still an issue, tests should be coherent between languages. Moreover positive number is ambiguous. It should be stated as strictly positive. And we don't know if we get numbers with leading zeros and if they need to be considered as a correct ones.
This comment has been hidden.
Sample tests in Haskell are not working.
ByTheNumbersSpec.hs:1:53: Not in scope: `main' Perhaps you meant `min' (imported from Prelude)
Use GHC 8.x. Trying to fix that.
Already solved because full tests are fine. GHC 8.x was unavailable when I posted the issue.
GHC 8.2 now available
Julia translation
Yep, and that was a week, finally.
Bah, was very confused as my code editor/linter was b!tching up a storm for the use of backslashes. I coded it with front slashes then once it worked I changed front slashes to double backslashes expecting it to fail but it passed! Hahaha
Haskell translation
Any power user want to approve this?
Approved.
Please see issue above. I tried to fix it, but it wouldn't let me enable GHC 8.2. Can you fork your translation?
Not right now. Very spotty internet access here.
Ok, forked it. Try to approve, see if it helps. Couldn't approve myself.
Of course you can't, you made it yourslef :yum: But since the author was active recently, I can't approve it til a week.
@Johan also, would you mind forking the Julia translation to fix merge conflict? If I forked, then I couldn't approve it.
Forked it. Haven't done any checking beyond the description ( did fix the repeated "of" there ).
@JohanWiltink: There's an issue with the Haskell translation. See above. Regards, suic
Thanks for the heads-up. See above.
Needs random tests
Added.
Awesome! Thank you Cliffstamp. Is it live or do I have to "approve" it somehow?
Nice kata! Thanx!
Nice kata! I like the balance of challenge and simplicity.
I would recommend more test cases, especially:
\
in it at all\
followed by one or more numbers, it would be good to see numbers mixed into the rest of the string, numbers at the very beginning (without a\
), and other non-alhpanumeric characters.It also might be good to clarify some specifics:
'\abc'
— would this show up? Is it valid? What's the output? (Personally, I don't think this needs to handle errors, just that it should be called out in the description!)'abc\5de\4fghi'
— should this error, or return['a', 'b', 'c', 'de', 'fghi']
?'a\2\3bcd'
''
), or a string with only a group ('\5'
)?Ooh. Good advice. I'll get started on a revision to take your suggestions into account. Thanks!
I finally got a moment to update with the suggestions.
Much nicer!
Your example test cases have some problems (missing punctuation, and the input doesn't match the output "jklm" vs "j", "k", "l", "m" for the first one). The solution test cases work fine, though.
Got it. This should be fixed now. I think. (first kata published)
Looks good to me!