I'm currently trying very hard to assign a variable inside a function.
Therefore I'm using a function like this, which should reassign a predefined variable.
assign[a_] := (HoldForm@a = 2)
a=1;
assign[a]
The problem is that Mathematica uses the value of "a" instead of its name.
Any suggestions?
Hold. Alternatively you could perhaps useUnevaluated. But, trying to do the assignment asHoldForm[a] = whateveris not valid sinceHoldFormisProtected. – Oleksandr R. Jan 13 '14 at 01:35