Dear all,

I'm embarrased to say this, but I'm very puzzled by the behaviour of the Add
function. I have this simple test code:

--------------------------------------
 TestFun:= function(n)
   local perm, out, i;

   out:= [];
   perm:= [];
   for i in [1..n] do
       perm[i]:=0;
   od;
   for i in [1..n] do
       perm[i]:= i;
       Add(out, perm);
   od;
   return out;
 end;
----------------------------------

If I now make a call to Test(3), I should get [ [1,0,0], [1,2,0], [1,2,3] ],
right? However, I'm getting [ [1,2,3], [1,2,3], [1,2,3] ]. Do you get the
same thing? Can anybody explain to me what's happening here?

Thank you very much in advance,

Hebert Perez-Roses
The University of Newcastle, Australia
_______________________________________________
Forum mailing list
Forum@mail.gap-system.org
http://mail.gap-system.org/mailman/listinfo/forum

Reply via email to