# Map[Remove[#]] doesn't seem to do anything

If you have a symbol with a value, you can clear it with Remove[]. Thus

a=1;
Remove[a];
a(*returns unevaluated, as it has no value*)


But if you have a list of symbols with values, it does not seem to work to map Remove[] across them. Thus

a = 1; b = 2; c = 3;
Map[Remove[#] &, {a, b, c}];
a (* returns 1, as the variable was never cleared *)


Is there a good reason why this isn't working?

• Very good reason: after a = 1, a has the value 1. So you essentially do Remove[1] - change Remove to some generic f and see how it woks. – corey979 Nov 18 '16 at 18:49
• In the second case the list {a,b,c} gets evaluated to {1,2,3} first, so Remove only gets the numbers, as you can see from the errors , "Remove::ssym: 1 is not a symbol. >>" – george2079 Nov 18 '16 at 18:49
• I noticed that many people here use f[#]& /@ ... instead of f /@ .... I'm not sure why. Not only is it unnecessarily complicated, it also effectively removes any Hold* attributes the function may have. – Szabolcs Nov 18 '16 at 21:43
• @Szabolcs Turns out it's a habit. – corey979 Nov 18 '16 at 22:32

As stated in the comments, a is evaluated before being fed into Remove. We can prevent this by using Unevaluated:

a = 1; b = 2; c = 3;
Remove /@ Unevaluated[{a, b, c}];
a

a


One can also use Apply instead of Map to effectively achieve Remove[a, b, c]:

a = 1; b = 2; c = 3;
Remove @@ Unevaluated[{a, b, c}];
a

a

• Or just Remove[a, b, c] – Bob Hanlon Nov 18 '16 at 19:02
• @BobHanlon Yes, good point. I assume OP is in some situation (not sure how) where he can't manually type out the variables. – Chip Hurst Nov 18 '16 at 20:46