-
-
Notifications
You must be signed in to change notification settings - Fork 393
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
Pluralized macros return tuples #2844
Conversation
Pluralized macros (e.g. @variables) now return vectors of whatever the 'singular' macros return. E.g. the following new tests pass: vars = @variables(model, begin x y[1:2] end) @test vars == [x, y] eqs = @Constraints(model, begin E_x, x == 0 E_y[i=1:2], y[i] == 0 end) @test eqs == [E_x, E_y]
Tuples seem like a better choice than vectors in this case. They'll give the compiler a chance at inferring the types of the elements if the situation permits. See https://discourse.julialang.org/t/when-to-use-tuples/18675. |
I have no issue with using tuples instead. |
Codecov Report
@@ Coverage Diff @@
## master #2844 +/- ##
=======================================
Coverage 94.78% 94.78%
=======================================
Files 44 44
Lines 5695 5698 +3
=======================================
+ Hits 5398 5401 +3
Misses 297 297
Continue to review full report at Codecov.
|
The documentation is failing because there are a lot of new printing changes now that
|
Fix documentation
Thanks @MartinBonde |
Closes #2837
Pluralized macros (e.g. @variables) now return vectors of whatever the 'singular' macros return.
E.g. the following new tests pass:
vars = @variables(model, begin
x
y[1:2]
end)
@test vars == [x, y]
eqs = @Constraints(model, begin
E_x, x == 0
E_y[i=1:2], y[i] == 0
end)
@test eqs == [E_x, E_y]