ruby
ruby copied to clipboard
Adding a keyword argument to Series
We don't have an early core exercise that introduces keyword arguments. In a discussion between @ Josh and @kotp it became clear that in the Series exercise, it's not per se clear that the passed in number is indicating a slice size or the number of slices that should be returned. Looks like a perfect candidate for a keyword argument to me!
@pgaspar @kotp What do you think? And is this (reasonably) doable?
Current supporting information is the information in the readme which reads:
Given a string of digits, output all the contiguous substrings of length `n` in
that string in the order that they appear.
For example, the string "49142" has the following 3-digit series:
- "491"
- "914"
- "142"
And the following 4-digit series:
- "4914"
- "9142"
And if you ask for a 6-digit series from a 5-digit string, you deserve
whatever you get.
Note that these series are only required to occupy *adjacent positions*
in the input; the digits need not be *numerically consecutive*.
and the canonical data.
Are we still accepting changes for this issue? (checking in relation to issue #935), and if so, would it be acceptable to add a test generator as part of the same commit (since the tests would have to be updated in either case)?
@pgaspar Could you respond to the question about the test generator?
About the keywords: Yes to adding the keywords. With one caveat: there are some weird things with this exercise. I discovered that last week, so the exercise may change again shortly. I don't expect that it would affect the presence of keyword arguments though. Or would you prefer to wait for the next version? (The new issue should be up for discussion later this week. )
@F3PiX @bergbergs I think adding a test generator makes sense - I'm not sure why it wasn't added before. Possibly because it's an old exercise.
I am still interested in this issue/PR, but I think it makes sense to wait until the issue @F3PiX mentioned is posted, as I don't think it makes sense to release two substantive changes to the exercise in quick succession. I'll hold until then.
I'd like to keep series
as is, but I would welcome some new exercises that use keyword arguments as we will certainly implement a concept exercise for this, and will therefore want to unlock exercises that help practice it.
I'm going to go ahead and close this issue.