I want to create a function that when it is called clears the value of a parameter.
For example I want to keep the value of a parameter and then clear its valueby calling a function:
a = 1;
f[x_] :=
{b = x;
Clear[x]}
f[a]
However calling f[a] gives an error Clear::ssym: 1 is not a symbol or a string as expected. How can I overcome this problem.
f. See http://mathematica.stackexchange.com/a/18737/121 and http://mathematica.stackexchange.com/q/17767/121. (I favor marking this question as a duplicate) – Mr.Wizard Nov 12 '16 at 14:44awhen the internalxis cleared? – Edmund Nov 12 '16 at 14:44x, as there would be withModule; at the time of evaluation it has already been replaced with1. I suppose you know this but it might still confuse new users. – Mr.Wizard Nov 12 '16 at 14:46