[top][index]
search for:

backtrace -- trace back through evaluations after an error

backtrace() -- after an error, returns a list representing the steps in the computation that led to the error.

The elements in the list are expressions that can be examined, or reevaluated with value, or are references to positions in the source code.

Bug: some of the expressions are reconstructed from the local variables of the function returning an error, so the parameters passed to the routine may have been replaced by new values.

See also:

  • Expression -- the class of all expressions
  • Position -- the class of all file positions
  • Code:

         -- ../../../Macaulay2/m2/expressions.m2:1141-1148
         backtrace = () -> apply(toList deepSplice report, 
              i -> (
                   if class i#0 === String then new Position from i
                   else if class i#0 === Function then new FunctionApplication from i
                   else if class i#0 === Symbol and #i === 3 then new BinaryOperation from i
                   else i
                   )
              )

    [top][index]
    search for: