How can I extract part of a held expression without evaluating it?
Clear[w]
Part[HoldForm[w = 3],1,1]
(* w *)
w = 4
Part[HoldForm[w = 3],1,1]
(* 4 *)
Here I would like to obtain "w" again, not its current value. How can I extract the unevaluated symbol on the lhs of the definition, if the symbol has a value already before the definition is made in the hold form? "Part" seems to always evaluate the extracted part of the held expression. Is there a way to prevent this? Of course the problem is the same when I extract part of the rhs of the definition or when I extract any part of any held expression. I would like to use this inside of a function which takes as the argument any expression. This expression is then held and extractions made from it. So the solution should work without knowing in advance what the symbol on the lhs of the definition is and whether it is bound or not.
Thanks for help!
Extract[HoldForm[w = 3], {1, 1}, Hold]
$\endgroup$w = 4; Hold[ w = 3 ][[ {1}, 1 ]]
$\endgroup$