-
Notifications
You must be signed in to change notification settings - Fork 519
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
series: Clarify edge case of zero-length substrings #1751
Conversation
The intuition is:
When the slice length is 0, the first slice starts & ends at the first of these spots, the second one starts & ends at the second spot, the third one at the third, etc. There is always one more start/end spot than there are letters. |
What do you expect the result to be if the length of the substrings is zero? | ||
There is no one right answer, but we expect you to output a number of empty strings: | ||
one more than the length of the input string. | ||
While not intuitive to everyone, this upholds the property that the number of substrings is one more than the length of the input string minus the length of the substrings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe simplify it and make it a little less apologetic (when someone doesn't have the context of this being controversial, it probably seems confusing to explain it in such depth, rather than just telling them the requirement).
What do you expect the result to be if the length of the substrings is zero? | |
There is no one right answer, but we expect you to output a number of empty strings: | |
one more than the length of the input string. | |
While not intuitive to everyone, this upholds the property that the number of substrings is one more than the length of the input string minus the length of the substrings. | |
Different languages on Exercism have different expectations about what the result should be if the length of the substrings is zero. | |
For Rust, we expect you to output a number of empty strings, which will one greater than the length of the input string. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot. 🙇🏻♂️ Even though we can agree this is not ideal, at least we have a clear expectations documented now, which is a reasonable trade-off considering we don't want to break all existing solutions.
https://forum.exercism.org/t/should-the-series-exercise-be-fixed-or-clarified/7429/9