Is it possible to detect the non-standard transformation rules (DownValues
, UpValues
, etc) that activate in an evaluation (and remove them)?
With non-standard I mean user defined, but the transformation rules assigned to Unprotected objects should be a good enough proxy for this.
So say I have assigned a downvalue for f
, f[x_]:= x
, and I input transformationDetection[f[1]]
it would output the downvalue (and optionally remove that downvalue). Similarly if a chain of transformations are triggered it would output all of them (and optionally remove all of them).
*Values
. But there might be an effective way to rephrase you problem to get around that. $\endgroup$*Values
you want to work with,TraceScan
will get the job done for you. Basically just write atestValuesl[expr]
function toTraceScan
over the evaluation tree. If it's just onUnprotected
symbols your life is pretty good. UsetestValues[s_Symbol?(Function[Null, FreeQ[Attributes[#], Protected], HoldFirst])[args__]]:=Echo[s]
or something. $\endgroup$