-
Notifications
You must be signed in to change notification settings - Fork 253
Document unicode math operators #3737
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
base: development
Are you sure you want to change the base?
Conversation
I'm still opposed to this change, cf my rejected PR #3599 |
It wasn't rejected. We requested changes to balance introducing a new, useful feature while staying clear of undefined behavior when packages define conflicting keywords, at least until the details of that are ironed out. I think with relatively minor changes, it can still make it to this upcoming release. |
@@ -74,6 +74,15 @@ assert Equation(x#0, 28) | |||
Foo @ Foo := (x, y) -> Foo(4*x#0 - 5*y#0) | |||
x @= Foo 7 | |||
assert Equation(x#0, 77) | |||
Foo · Foo := (x,y) -> Foo(6*x#0 * 7*y#0) | |||
x ·= Foo 8 |
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.
This looks awkward, and I'm not convinced that it is useful enough to justify supporting it.
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.
My original thought was that every flexible binary operator (as long as it didn't introduce ambiguity when appending an extra =
, like ==
-> ===
) should support augmented assignment out of the box.
While it's certainly true it would probably be a bad idea to use ·=
for an augmented dot product (First v
is a vector, but after v ·= w
, it's an element of the ring...), we might as well make it available for some other context where it might make sense.
To insert this character in Emacs, you may press @KBD "C-x 8 RET"@ | ||
or @KBD "M-x insert-char"@ and then enter "squared times" in the | ||
minibuffer. | ||
|
||
Alternatively, you may press @KBD "C-x RET C-\\"@ or | ||
@KBD "M-x set-input-method"@ and then enter "TeX" in the minibuffer. | ||
Afterwards, typing "\boxtimes" will input the ⊠ character. You may then | ||
toggle the input method using @KBD "C-\\"@ or | ||
@KBD "M-x toggle-input-method"@. |
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.
Since these paragraphs are mostly repeated, it may be worthwhile to have an automated section printed at the bottom of unicode operators that explains how to enter them. e.g. something like the "For the programmer" section underneath operators, which explains how to define methods on them.
Also, I still think every unicode operator should be tied to an ascii method name so it can be still used without unicode entry (e.g. **
and tensor
for
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.
I like the idea of an automated section -- I'll push a proposal here in a bit.
As for the ascii method name... I'm not sure if we should force a particular name for each operator, or just leave it up to package authors. Maybe one package has ⊠ to be a shortcut for externalTensorProduct
and another for strongProduct
, etc.
But yeah, we should probably provide an ascii version for each method that's actually defined. I'll go ahead and add dotProduct(Vector, Vector)
as a synonym for Vector · Vector
.
f67be45
to
1fe0f56
Compare
I ended up dropping the
|
In particular, this enables ⧢=, ⊠=, and ·= out of the box.
1fe0f56
to
f29ad8b
Compare
For the record, the solution is to either use |
We document the three unicode math operators that were added back in #3584 (·, ⊠, and ⧢).
We also:
Add aVector · Vector
dot product method.