-
Notifications
You must be signed in to change notification settings - Fork 28
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
Infix operators #10
Comments
Here is a snippet to show for c in '\u0300':'\u036f'
print("*", c, " ", "+", c, " ")
end
println() Output:
Here is how it looks in my terminal (using UbuntuMono font in urxvt): |
Unfortunately the subscript l does not show up for me (in either Juno or REPL), so I think that's out, unless there's an easy fix. I just added |
Sadly,
|
I don't know about Do we envision other lazy operations? If so, a sub/superscript may be the best. If only subscript |
Ah, I get what you are saying about
Point-wise subtraction could be useful to have.
How about the superscript?: |
I think an important question here is if we want to have a lazy Hadamard/elementwise product because then we need two flavors of |
Remember we always have the explicit |
I just wanted to point out the naming system that just append a suffix is going to break if we want infix operator for the two flavors of multiplication. But I agree that's very unlikely. |
I think |
As briefly discussed in #8 (comment), it'd be nice to have some infix operator for
Mul
andAdd
.FYI here is the list of infix operators with plus and time precedence (from https://github.com/JuliaLang/julia/blob/master/src/julia-parser.scm):
(define prec-plus (append! '($) (add-dots '(+ - |\|| ⊕ ⊖ ⊞ ⊟ |++| ∪ ∨ ⊔ ± ∓ ∔ ∸ ≏ ⊎ ⊻ ⊽ ⋎ ⋓ ⧺ ⧻ ⨈ ⨢ ⨣ ⨤ ⨥ ⨦ ⨧ ⨨ ⨩ ⨪ ⨫ ⨬ ⨭ ⨮ ⨹ ⨺ ⩁ ⩂ ⩅ ⩊ ⩌ ⩏ ⩐ ⩒ ⩔ ⩖ ⩗ ⩛ ⩝ ⩡ ⩢ ⩣))))
(define prec-times (add-dots '(* / ÷ % & ⋅ ∘ × |\\| ∩ ∧ ⊗ ⊘ ⊙ ⊚ ⊛ ⊠ ⊡ ⊓ ∗ ∙ ∤ ⅋ ≀ ⊼ ⋄ ⋆ ⋇ ⋉ ⋊ ⋋ ⋌ ⋏ ⋒ ⟑ ⦸ ⦼ ⦾ ⦿ ⧶ ⧷ ⨇ ⨰ ⨱ ⨲ ⨳ ⨴ ⨵ ⨶ ⨷ ⨸ ⨻ ⨼ ⨽ ⩀ ⩃ ⩄ ⩋ ⩍ ⩎ ⩑ ⩓ ⩕ ⩘ ⩚ ⩜ ⩞ ⩟ ⩠ ⫛ ⊍ ▷ ⨝ ⟕ ⟖ ⟗)))
We can also add suffixes and combining characters JuliaLang/julia#22089
Some ideas:
*″
+″
: Declare some common suffix to represent lazy version (e.g., double-prime″
). It would be handy if we need more operators in the future (e.g,-″
).*ₗ
+ₗ
: Same idea but with a subscriptl
(or maybe superscript).*̂
+̂
: Same idea but with combining character. It may be hard to recognize in some fonts.⋆
: good for lazy multiplication, as it looks like*
but sufficiently different to distinguish?⊕
: good for lazy sum as it already has semantics of element wise sum (direct sum)? But this does not apply toMul
.I think common suffix (like
ₗ
and″
) is a good choice as it provides a uniform style and it is extensible.The text was updated successfully, but these errors were encountered: