Question: How to remove an index from a table?

I would like to remove from a table, the index that verifies some constraint.

For example :

restart:
a := table([1=c, 2=g, 3=y]);

for k in [indices(a, `nolist`)] do
  if is(k, even) then
    a[k] := 'a[k]':
  end if:
end do:

# This does not work as expected 
eval(a);


I have found this workaround 

b := map(u -> if `not`(is(u, even)) then u=a[u] end if, [indices(a, `nolist`)]);
eval(b);

But is there a way to force Maple to evaluate k to 2 before it "unevaluate"  'a[k]' ?

 

Please Wait...