-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
string division: "pre"\"prefix" => "fix", "suffix"/"fix" => "suf". #13411
Conversation
Is it April 1st already? |
Nope. This is mathematically sound. Try doing this with minus. |
Could be useful. Agree that it's consistent. |
I also agree it's consistent, but I didn't think we wanted to double down on using arithmetic operators on strings. |
Also - why in Base, when these could perfectly well go into a package, for anybody who thinks they might be useful? |
|
This does seem like a rather marginal use to occupy an operator for. I'd prefer to have it undefined in Base so I can keep mapping |
We should either stop using |
I think the saner alternative here is probably to keep in mind that there's an algebraic structure to strings and regexes but not use arithmetic ops for it. |
Yes, this is not a totally made up operation – the notation even matches what's used in academic literature (which is why I chose |
Yeah, that's strange. Seems that it would destroy a lot of useful
properties that the operation would satisfy otherwise (in the cases when it
is defined).
|
I realized that writing string concatenation as
*
allows you to naturally use\
to strip prefixes from strings and/
to strip suffixes from them, which is kind of cute.