Skip to content
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

Document customizable binary operators #33479

Merged
merged 3 commits into from
Nov 4, 2019
Merged

Document customizable binary operators #33479

merged 3 commits into from
Nov 4, 2019

Conversation

JeffFessler
Copy link
Contributor

I learned indirectly through comments on a PR that \otimes and \oplus and \odot can be extended as binary operators yet I cannot find this fact anywhere in the documentation. Search the docs for oplus yields nothing.
Somewhere there must be a list of which characters can be extended this way and it should be documented in the manual.
This PR is an attempt to get that ball rolling!

I learned indirectly through comments on a PR that \otimes and \oplus and \odot can be extended as binary operators yet I cannot find this fact anywhere in the documentation.  Search the docs for `oplus` yields nothing.
Somewhere there must be a list of which characters can be extended this way and it should be documented in the manual.
This PR is an attempt to get that ball rolling!
@mcabbott
Copy link
Contributor

mcabbott commented Oct 6, 2019

Sounds good to have. The complete list is here:
https://github.com/JuliaLang/julia/blob/master/src/julia-parser.scm#L29

(Note also that by postfix I think you mean prefix!)

I also can’t find where it is mentioned that things like *′(x,y) = x*y/2 also create infix operators. Is this in the manual?

@JeffFessler
Copy link
Contributor Author

@mcabbott thanks for the link. I added it to the PR and also fixed the typo you mentioned.

I was unaware of the syntax you mentioned. Cautionary note to anyone who tries to reproduce it: the quote in *′(x,y) = x*y/2 is not an ordinary apostrophe! Seems like something that should be documented as well. Not sure where it would go.

@dkarrasch dkarrasch added the domain:docs This change adds or pertains to documentation label Oct 6, 2019
@mcabbott
Copy link
Contributor

mcabbott commented Oct 6, 2019

It may be mentioned somewhere logical! But you are allowed any unicode decoration like ⊗ᵣ(x,y) = kron(y,x); /₂(x,y) = x/y/2.

The exact line I linked is the symbols parsed like * (in terms of precedence, and associativity), but there are more parsed like + or like -> etc.

@JeffFessler
Copy link
Contributor Author

Thanks for the clarification. I've updated the PR to tell the story somewhat more generally.

@StefanKarpinski
Copy link
Sponsor Member

@JeffBezanson, can you give a read through and merge if you approve?

@JeffFessler
Copy link
Contributor Author

@JeffBezanson, it's been a few weeks so I thought I'd make a gentle ping...

@StefanKarpinski StefanKarpinski merged commit f45b6be into JuliaLang:master Nov 4, 2019
KristofferC pushed a commit that referenced this pull request Apr 11, 2020
* Document customizable binary operators

I learned indirectly through comments on a PR that \otimes and \oplus and \odot can be extended as binary operators yet I cannot find this fact anywhere in the documentation.  Search the docs for `oplus` yields nothing.
Somewhere there must be a list of which characters can be extended this way and it should be documented in the manual.
This PR is an attempt to get that ball rolling!

* Add url for list and fix prefix typo

* Expand docs of infix binary operators.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:docs This change adds or pertains to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants