-
Notifications
You must be signed in to change notification settings - Fork 120
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
Use @varnames_interface free_group
#3317
Conversation
I find my self always typing |
I guess The difference with So I could see some justification to handle But I'd like to decouple that problem from this PR, so I'll look into the |
This is now ready for review (regardless of whether it passes the test suite or not, I'll fix that up later if necessary). In particular I've written a comprehensive docstring 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 think this is going in a great direction. I added some comments to things I find weird. And CI is unhappy that you broke free_group()
without any arguments
src/Groups/GAPGroups.jl
Outdated
@@ -2269,7 +2269,7 @@ nonzero then `pairs` is the vector of syllables of `x`, see [`syllables`](@ref). | |||
julia> G = free_group(2); pairs = [1 => 3, 2 => -1]; |
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.
Is it intentional that you didn't change it here?
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.
yes
|
||
Note that the `varname => vector` syntax for specifying a vector or | ||
matrix or general array of variables behaves slightly differently | ||
compared to `free_group`, as the following example demonstrates. |
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.
Why is this different? Is this something you really want to have or is it just very hard to work around?
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 was back then agreed upon for the behavior of @varnames_interface
as users from algebraic geometry wanted e.g. @polynomial_ring(QQ, :x => (1:2,1:2))
to produce variables x12
etc. not a matrix x
.
Honestly I am not that happy with it anymore. I would prefer if we had
@polynomial_ring(QQ, "x" => (1:2,1:2))
defines in the current scope a 2x2 matrixx
@polynomial_ring(QQ, "x#" => (1:2,1:2))
defines the current scope four variablesx11,x12,x21,x22
Then hopefully usage would still be convenient enough for users from algebraic geometry? I'll ask @wdecker when I am back from vacation.
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.
(In particular this is not something I can reasonably change in this PR)
- enables many variants of the `free_group` argument syntax - adds `@free_group` macro
Co-authored-by: Lars Göttgens <[email protected]>
d4319c0
to
7c09257
Compare
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.
Nice.
There is a cross-reference from free_group
to @free_group
, shouldn't @free_group
be in the manual?
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3317 +/- ##
==========================================
+ Coverage 84.56% 84.58% +0.02%
==========================================
Files 597 597
Lines 82197 82246 +49
==========================================
+ Hits 69508 69566 +58
+ Misses 12689 12680 -9
|
Co-authored-by: Lars Göttgens <[email protected]>
free_group
argument syntax@free_group
macroImplements part of #3125
The main issue is the changed return value. I did not bother to adjust all tests or documentation in this PR to that, the changes I made are enough to illustrate the pros and cons I think: returning the group and generators is nice and natural in some cases, and ugly and unnatural in others (just like with
polynomial_ring
I guess ;-) ).But the major concern I have about it is that it now differs from all other (GAP based?) group constructors. Of course all of these could also be made to return generators, but this change is more and more breaking.
So right now my thought would be to drop this part and let
free_group
only return the group. OK? Thoughts?To make this possible, we'll have to either tweak
@varnames_interface
a bit, or else use a little trickery (like: renamefree_group
to_free_group
, then letfree_group
just pass all its arguments to_free_group
.).This looses any ability to retain the "grouping" of variables when using
free_group
, i.e., there would be no direct replacement forF, x, y = free_group(:x => 1:3, :y => 1:3)
.However, it would be retained for the macro version: