-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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 \angle as a unary and binary operator #16760
Conversation
This seems somewhat reasonable to me. I can't find any existing Julia packages that use I'm less convinced that we should define the |
(On a related note, I've often thought that it would be nice to parse |
Or a quantity with |
Or just define (I always forget about the possibility of multiplying by juxtaposition.) |
We should have the syntax and let packages define it as the want to. |
@StefanKarpinski, you're referring to There is the question of precedence. The advantage of giving it |
It seems that * precedence makes most sense, because the syntax |
It doesn't directly affect this PR, but you should probably use |
I didn't mean to mark this as WIP. I agree with @stevengj that definition of ∠ can be left to packages. |
@stevengj: I was referring to adding both |
(I tend not to like having |
Any objections to including this? |
lgtm |
Shall we pull the trigger and merge this then? |
Lets do it. I guess the downside is that it could break existing code (e.g. |
Some uses wouldn't even break since symbols are just normal identifiers with some special parsing rules: julia> let + = 1.5
(+)^2
end
2.25 Note that you need the parens around the |
Works in 1.6 |
Add's \angle (∠) as a unary and binary operator. My main use is for nicer entry of complex numbers in polar coordinates. Prior art for this includes the TI 89 and the HP 48 calculators. Both have angle buttons to help with entry of complex numbers.
Here is an example use:
The main downside of this PR is removal of this character for use in variables. There are other angle characters available, though.