This is documentation for Mathematica 5, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

Documentation / Mathematica / Built-in Functions / Programming / Debugging /


FilledSmallSquare Trace[expr] generates a list of all expressions used in the evaluation of expr.

FilledSmallSquare Trace[expr, form] includes only those expressions which match form.

FilledSmallSquare Trace[expr, s] includes all evaluations which use transformation rules associated with the symbol s.

FilledSmallSquare In general, form in Trace[expr, form] is compared both with each complete expression that is evaluated, and with the tag associated with any transformation rule used in the evaluation.

FilledSmallSquare Trace[expr, lhs -> rhs] picks out expressions which match lhs, then replaces them with rhs in the list returned.

FilledSmallSquare All expressions in the list returned by Trace are wrapped in HoldForm.

FilledSmallSquare Trace returns a set of nested lists. Each individual list corresponds to a single evaluation chain, which contains the sequence of forms found for a particular expression. The list has sublists which give the histories of subsidiary evaluations.

FilledSmallSquare Example: Trace[2 3 + 4] LongRightArrow.

FilledSmallSquare The following options can be given:

FilledSmallSquare During the execution of Trace, the settings for the form argument, and for the options TraceOn and TraceOff, can be modified by resetting the values of the global variables $TracePattern, $TraceOn and $TraceOff, respectively.

FilledSmallSquare See Section 2.6.4 and Section 2.6.11.

FilledSmallSquare See also: TraceDialog, TracePrint, TraceScan, EvaluationMonitor.

FilledSmallSquare New in Version 2.

Further Examples