[GAP Forum] procedure to change a permutation, not returning it

Rafael Villarroel rafaelv at uaeh.edu.mx
Tue Apr 19 22:06:57 BST 2016


Hello GAP forum,

Is it possible to define a function that returns, say, an integer, but
changes a permutation given as argument, as a side effect.

Something like this:

testperm := function(s)
    local i;
    i := 1;
    s := s^-1;
    Print(s,"\n");
    return i;
end;

but that when running it like this...

gap> a:=(1,2,3);
(1,2,3)
gap> testperm(a);
(1,3,2)
1
gap> a;
(1,2,3)

...actually changes the permutation a.

Thanks in advance,
Rafael




More information about the Forum mailing list