-
-
Notifications
You must be signed in to change notification settings - Fork 396
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
Feature Request: Unicode comparison support. #171
Comments
Yes, this should be pretty easy to properly support and will look pretty cool in the end. |
We can hopefully say that JuMP 0.5 is the last branch to support Julia 0.2. We might hold off on implementing this until we officially drop support for 0.2 in master, though. |
Not sure why my comment seems to have been deleted, but I think it might actually be pretty straightforward to make it backwards compatible. We just need to add checks for the :≤ symbols and such:
|
We can reference the
|
So the implementation itself will be compatible with 0.2, but any tests/examples we have won't work. |
I'm fine with that since this will most likely be undocumented anyway. |
I think we should actually show off this syntax when we can. |
Undocumented for now, at least. I have this done and will push assuming we can hold off on the evangelizing until 0.3 lands :) |
PR? |
If it doesn't require git magic. |
Oh cool. That was quick. Thanks @joehuchette, @mlubin. That PR looks about the same as what I was trying out :) Not to be too demanding, but what are your thoughts on |
I'm not crazy about |
Yeah, wasn't too sure about |
It looks like it's an alias for |
I like Σ and ∏. Those will require some changes to ReverseDiffSparse. The length-one character for equality is |
There's double hyphen [1] |
Yeah that'll just cause more confusion (I wonder if Julia canonizes it into Btw thanks for using JuMP and your feedback! |
Really great to have such an open development process. Thanks again. |
add support for unicode comparison operators in macros (#171)
This will be in the 0.6 release of JuMP. To try it out, you can use the master branch with |
Works great. Might be worth mentioning in 0.6's release notes which sigma is used. I was using |
Oh, that's an annoying. Let's reopen the issue until we decide what to do about that (and also update the docs and examples) |
We could just check for both, although I'm not sure if that's ideal. |
I'd have realized what was happening much quicker if the error message error("Expected sum outside curly braces") had suggested which symbol could be used. Something like: error("Expected sum (or ∑) outside curly braces") might be sufficient. Perhaps the hex value |
Unfortunately we have to be careful with printing unicode values from JuMP because they break the windows terminal. |
We could use error("Expected sum (or \u2211) outside curly braces") but that's kind of ugly |
Can/should you canonicalize similar-looking unicode identifiers? |
I don't see the harm in allowing both Σ and ∑. Unless there are a number of other similar characters, it's probably easier to just explicitly check for these two than to deal with unicode normalization. |
That sounds like the nicest solution. There are a couple of bold and italic variants, but I doubt anyone will be trying to use those in practise. |
It looks like JuliaLang/julia@82e34b6 may have disallowed using
|
So the letter = bad, mathematical symbol = good? |
But ∑ is classified as a Mathematical Operator by Unicode. If it was parsable as an operator in Julia, you could do |
Oh man I'm confused. Funny enough, PackageEvaluator detected this breaking another package last night: JuliaQuant/MarketTechnicals.jl#32 |
PackageEvaluator is going to be great in catching these subtle little changes in the language that end up breaking things. |
Oops, my description is a bit confusing reading it again now. Just to clarify |
This should be fixed on master. |
Confirmed passing on travis now. |
Just updated NEWS, I think we can close this. |
Recently JuliaLang/julia#6582 got merged adding support for the
≤
and≥
operators. Would it be possible to add support for these in the JuMP macros? Currently I get the following results:So it's partially supported already it would seem – perhaps unintentionally though. Obviously this isn't urgent, but might be a nice feature some people would use. If it doesn't require massive changes to JuMP's internals then I'd be happy to try and add it myself.
PS Using JuMP is really intuitive and is a great example of what Julia can do. Thanks for all the work you guys have put into it.
The text was updated successfully, but these errors were encountered: