This is documentation for Mathematica 3, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)
 Documentation / Mathematica / Built-in Functions / Programming / Debugging  /
TracePrint

  • TracePrint[ expr ] prints all expressions used in the evaluation of expr.
  • TracePrint[ expr , form ] includes only those expressions which match form.
  • TracePrint[ expr , s ] includes all evaluations which use transformation rules associated with the symbol s.
  • See notes for Trace.
  • TracePrint indents its output in correspondence with the nesting levels for lists generated by Trace.
  • The indentation is done using the print form defined for the object Indent[ d ].
  • TracePrint prints the forms of expressions before any of their elements are evaluated.
  • TracePrint does not support the TraceBackward option of Trace.
  • TracePrint yields only the forward part of the output specified by the option setting TraceAbove -> All.
  • TracePrint[ expr ] returns the result of evaluating expr.
  • See the Mathematica book: Section 2.5.10.

    Further Examples

    Here is the recursive definition of the Fibonacci numbers.

    In[1]:=

    Here are the end conditions for the recursion.

    In[2]:=

    Out[2]=

    This prints expressions encountered in the evaluation of fib[3].

    In[3]:=


    fib[3]


    fib[3 - 1]


    fib[2]


    fib[2 - 1]


    fib[1]


    fib[2 - 2]


    fib[0]


    fib[3 - 2]


    fib[1]

    Out[3]=