-
-
Notifications
You must be signed in to change notification settings - Fork 419
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
Add unchop to array and unchop, repeat_str and mul to string #3155
Conversation
I originally needed the Let me know if the preference is that some or all of these changes go through the RFC process instead. |
This commit adds the following: * Update `chop` in string and array to allow `is` to work correctly after an `unchop` * `unchop` to both array and string to allow the un-chopping of a chopped string or array * `repeat_str` and `mul` to string to allow easy repeating of strings
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.
Seems reasonable to me. And useful - I can think of some things I've worked on in the past where I'd have liked this to exist.
Does it also make sense to have an unchop_val
as well?
Not sure about |
I was thinking about use cases where you chop a buffer to get two However, I suppose it can wait until someone is writing a real-world program that actually has this need. |
I would accomplish the same thing by assembling them back together before converting to However, if you think it would be useful and regularly needed, I can add it in. Let me know. |
We can wait until the need arises in a real application. |
packages/builtin/string.pony
Outdated
fun mul(num: USize): String iso^ => | ||
""" | ||
Returns a copy of the string repeated `num` times with an optional | ||
separator added inbetween repeats. |
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.
From the looks of it, this docstring appears to be incorrect, as mul
does not accept an argument for a separator.
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.
Good catch. Fixed.
Is this ready for final review @dipinhora ? |
@SeanTAllen yes, marking as ready for review now. |
@dipinhora can you add release notes to this PR to be included in the "happening very soon" release? |
release notes (possibly):
|
This commit adds the following:
chop
in string and array to allowis
to work correctlyafter an
unchop
unchop
to both array and string to allow the un-chopping of achopped string or array
repeat_str
andmul
to string to allow easy repeating ofstrings