It is often that one wonders which arguments are evaluated before being passed into a function. I would like to know if it is possible to see which argumets are being passed into a function without recoding the function, that is, outside of the function. I know that one could try with the Trace command, but it always puzzles me whether the output one really sees reflects what is being sent into the function prior to its evaluation.
I suppose, that the key issue is being able to draw a clear line, and say, "yes, these expressions are being fed into the function, and, aha, these evaluations are done in the function". Is there a generic way of doing this without recoding the function (that is, one could put a bunch of print statements in the definition of the function)?
For example, I might want to know which arguments are actually passed to a built-in Mathematica function (which one cannot recode) and might need to know what is done with these arguments within the function code.
I suppose that the Trace command could be used, but I never figured out how.
Unprotect[foo]; foo[args___] := Null /; (Print["evaluating foo on arguments ", {args}]; False)
. Can be verbose though, if a yourfoo
is heavily used. $\endgroup$