I have a bunch of symbols which are collected as a list inside a variable within a bit of code e.g.
a=1;b=2;
par={a,b};
I want to clear the values of both a
and b
using only a reference to par
. Here is my attempt and the error produced:
Clear[Sequence@@par]
... Clear::ssym: Sequence@@par is not a symbol or a string.
I can understand why this gives an error but can't figure out a way out of it.
Thanks for your help
par
is simply{1, 2}
here, how would it know about the symbolsa
andb
? $\endgroup$??par
. $\endgroup$par = Hold[a, b];
and much later,Scan[Clear, par]
orClear @@ par
. $\endgroup$