I want to generate a list of maps in a function and return this list. For example the list of maps $$ [k\mapsto k+1,\ k\mapsto k+2,\ k\mapsto k+3] $$ I thought I could do this by the following code:
get_maps := function()
local maps,i;
maps := [];
for i in [1..3] do
Add(maps,k->k+i);
od;
return maps;
end;
But the value of i changes inside the function. So in fact I get three identical mappings $k\mapsto k+3$.
How can I access the value of i inside the function instead of the variable i?
mapshould beconstruct_map– Thorsten Dec 09 '16 at 13:22