Rougly my question is about constructing a function that maps Hold[var] to "var"
even when var has an assigned value. In details :
In var=22; A=Hold[var];
Can we construct a function F such that F[A] becomes the string, "var" ?
In fact, I can do it like :
In F[x_]:=StringDrop[StringDrop[ToString[x],5],-1]; In F[A]//InputForm Out "var"
But above method seems somewhat unnatural.
One natural,ideal way I think possible is :
- uncover Hold in Hold[var], with its content(=var) untouched, and apply ToString to the content.
Another natural,ideal way I think possible is :
- Change Hold in Hold[var] to ToString, with its content(=var) untouched.
Can you suggest natural ways to do it?