[GAP Forum] Storing GAP codes

Don King symmetryholic at yahoo.ca
Wed Feb 4 11:59:57 GMT 2009


Hello, I am a newbie of GAP and a lot of things are not still familiar to me. 
Currently, I am testing some external GAP sources that are available in this forum. 
The problem is I have to type every same codes for testing the same program. (I still could not figure out how to copy/paste to GAP console (gapw95.exe)). 
  
What I desire to do is to save a code like a batch file (or script file) and execute it using that batch file. 
For instance, I'd like to make the below code as a batch file so that I can execute the below routine using a batch file. 
  
Any help will be highly appreciated. 
Best regards, 
Don  
  
  
  
  
  
InvolutionFactors := function ( perm )
local x, y, c, n, i; 
if not IsPerm(perm) then
  Error("<perm> must be a permutation");
fi;
if OrderPerm(perm) <= 2 then
  return [ perm, () ];
fi;

  x := ();
  y := ();
  for c in Cycles(perm, [1..LargestMovedPointPerm(perm)]) do
    n := Length(c);
    for i in [1..QuoInt(n-1, 2)] do
      x := x * (c[i], c[n-i]);
    od;
    for i in [1..QuoInt(n, 2)] do
      y := y * (c[i], c[n+1-i]);
    od;
  od;
  return [x, y];
end;



      __________________________________________________________________
Instant Messaging, free SMS, sharing photos and more... Try the new Yahoo! Canada Messenger at http://ca.beta.messenger.yahoo.com/




More information about the Forum mailing list