I want the function to take in string, then assign a value to its corresponding symbol. An implementation using
mySet[str_String, val_] := ToExpression["Set[" <> str <> "," <> ToString[val] <> "]"]
How can I do it without
ToExpression? I wonder how this can be done with purely evaluation control.
I have read the following posts: Generating assignments and transforming code inside held forms when generating code
I think the main problem is to evaluate
Symbol["x"] partially to
x(it can have
OwnValues), which can't be achieved with first post's code; and second post's code is indeed returning a
HoldForm expression, leaving me generally the same problem.