[GAP Forum] The Add function
Hebert Pérez-Rosés
hebert.perez at gmail.com
Sat Jan 8 05:31:23 GMT 2011
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
More information about the Forum
mailing list