6 kyu
Chunky strings
54 of 107Paul Robertson
Loading description...
Strings
Recursion
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.
C# Translation (straightforward 1-1 to my earlier c++ translation).
Fun kata, but the rules of how we should achieve the desired result could be a bit clearer
those rules are unambiguous, unlike your user name
It's literally my initials and last name, what does your user name stand for?
here's the ambiguity with your name
Great logic and attitude, keep that up! :)
Bye, take care
Your name contains a hate symbol "SS". I will report you.
Haskell translation
C++ Translation
done
Just to note, I accidentally left the
It
title for the random tests asempty_string
rather thanrandom_test_cases
. I just used the editor to patch this up. Hope that's fineDon't use the editor, use rather the fork button, if you see it (just on the left of the edit button). The edit panel has side effects on contributors, when it comes to progress elligibility (as in: losing it), if they want to complete the kata in multiple languages and/or translate it also with the idea of gaining the progress in that language.
Oh that's strange - noted. Sorry if this affected anyone I just assumed this was too minor of a change to warrant forking again
no, the only potentially affected person is you, that's all.
The "make_chunk" method in random tests needs to be modified to accept a maximum depth parameter, which will help prevent occasional recursion limit errors during the generation of test cases.
this has already been fixed
IMO
0
is a perfectly good number, an empty string is a valid chunky string, and there should be a test with it.The fact that the example solution pukes on chunky strings of length
0
only strengthens me in this opinion.Ok, fixed.
I just noticed fixed tests only use, and random tests always generate, strings of exactly
1
chunk. The specs leave open the possibility of a string containing any number of chunks.What is the intention here?
If a chunky string is supposed to be exactly one chunk, length
0
actually does not make sense. ( The specs should also just say so. ) If a chunky string can contain multiple chunks, there should of course be tests with that.With
make_chunk(depth)
, there is no real reason to specify an upper bound to the string length anymore.The description now states that "A 'chunky string' is a string consisting of exactly one chunk.". So yes, the empty string case should be done away with; the only other alternative is to consider an empty string a valid chunk, which would lead to absurd conclusions
The intention was that a chunky string consists of exactly one chunk. I think I'll keep it like that for this kata.
I have kept an upper bound on the string length to limit the amount of output in case of an error
Empty string test case is now gone
No need for an upper bound if you set the recursive limit to 8 (in which case the maximum will be 255) or 7 (~115 or something iirc).
JS Translation
approved by someone
Method "make_chunk" in random tests should be adapted to take a maximum depth to avoid occasional recursion limit errors in test case generation.
Fixed.
Is it possible random tests could result in recursion limit?
yes, it is possible for random tests to result in a recursion limit error if the recursion depth exceeds the default limit set by python
fixed by author