Skip to content
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

SelectedGroups to GAP fails #26

Open
RussWoodroofe opened this issue Oct 13, 2022 · 5 comments
Open

SelectedGroups to GAP fails #26

RussWoodroofe opened this issue Oct 13, 2022 · 5 comments

Comments

@RussWoodroofe
Copy link
Contributor

RussWoodroofe commented Oct 13, 2022

In GAP 4.12.0, going into a GraphicSubgroupLattice and doing "SelectedGroups To GAP" from the Subgroups menu gives an error:

Error, Variable: 'last' is read only in
  SelectedGroups( sheet 
 ) at /Users/russw/Library/Developer/Xcode/DerivedData/CocoaGap-csyzydxxqinxbm\
cgmtbyxzibjxtx/Build/Products/Release/Gap.app/Contents/gap/pkg/xgap/lib/ilatgr\
p.gi:1257 called from 
menu!.functions[eid]( WINDOWS[wid + 1], menu, menu!.entries[eid] 
 ); at /Users/russw/Library/Developer/Xcode/DerivedData/CocoaGap-csyzydxxqinxb\
mcgmtbyxzibjxtx/Build/Products/Release/Gap.app/Contents/gap/pkg/xgap/lib/menu.\
gi:331 called from
<function "MenuSelected">( <arguments> )
 called from read-eval loop at *stdin*:20
type 'quit;' to quit to outer loop

I guess that the problem is that GAP 4.11 made last read-only.

A workaround is to call

gap> MakeReadWriteGlobal("last");

but this is almost surely not the right way to do things.

I'd be happy to put together a patch to address, but am not so sure what the right solution is. Is there an alternative correct way to get a value into last?

@RussWoodroofe
Copy link
Contributor Author

Looking further: perhaps updating the code to use UPDATE_STAT would be the way to go? The GAP source indicates that the function is intended for demonstration code, but it does appear to do what is desired.

@fingolfin
Copy link
Member

IMHO the bug is that it modifies last. Why does it do that in the first place?

@RussWoodroofe
Copy link
Contributor Author

Putting something in last is a somewhat sensible way to return information from the xgap sheet to the GAP command line, in a way that's easily accessible. I guess another alternative would be to make a new read-write global like "xgaplast", and putting the results in there (ideally with a helpful Info message)?

A use case is as follows. A user runs GraphicSubgroupLattice(G); on a complicated group. She then does some calculations at the command line to get a list of subgroups. When this list is in last, the InsertVertices from GAP menu option will add these to the subgroup lattice and/or highlight them in green. The user then interacts with the subgroup lattice, perhaps for example taking intersections, Sylow subgroups, or similar. At the end (or possibly during) this interaction, the user may want to get certain "new" groups from the subgroup lattice out for further work at the command line. The SelectedGroups to GAP menu option does this.

So I guess the design decision to put the result in last is for symmetry with InsertVertices from GAP (which certainly should take from last).

@fingolfin
Copy link
Member

Naive, genuine, question, but why is fine to take values from last ? From my perspective as a core GAP developer, last is purely for the user to read in interactive use; any functions relying on reading it are suspect. Maybe the reason why this is justified here anyway is clear if one is intimately familiar with xgap, but I am not... So any clarification would be appreciated :-)

@RussWoodroofe
Copy link
Contributor Author

RussWoodroofe commented Oct 16, 2022

There might be a better user interface. But the interface where you get a result up at the GAP command line, and then do "Insert from GAP" in the xgap sheet is pretty good: I think it is reasonably intuitive, as well as being fairly smooth to work with for an experienced user.

Is there a more correct way to implement this interface as far as the GAP programming interface goes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants