I have been trying to write a routine MyHead and MyPart which would have the following properties.
MyHead[2+3]
evaluates to Plus
MyHead[(2+4)[10,11]]
evaluates to 2+4 (and not 6).
MyPart[f[2+3,10+11],1]
evaluates to 2+3
MyPart[f[2+3,10+11],2]
evaluates to 10+11
Ideally, this could be used to deeply dive into an expression. For example, it could find the local variables in the module
g[x_] := Module[{y,z,w},t];
from
Defintions[g]
I can't get it. Any suggestions?
Mark