Sponsored links: Algebra eBooks
 

Help Index

A

B

C

D

E

F

G

H

I

J

K

L

M

N

O

P

Q

R

S

T

U

V

W

X

Y

Z

The Maxima on-line user's manual

Algebra Calculator

Search:

Trace_options Calculator

Trace_options

Function: trace_options (<f>, <option_1>, ..., <option_n>)

Function: trace_options (<f>) Sets the trace options for function <f>. Any previous options are superseded. trace_options (<f>, ...) has no effect unless trace (<f>) is also called (either before or after trace_options).

trace_options (<f>) resets all options to their default values.

The option keywords are:

* noprint Do not print a message at function entry and exit.

* break Put a breakpoint before the function is entered, and after the function is exited. See break.

* lisp_print Display arguments and return values as Lisp objects.

* info Print -> true at function entry and exit.

* errorcatch Catch errors, giving the option to signal an error, retry the function call, or specify a return value.

Trace options are specified in two forms. The presence of the option keyword alone puts the option into effect unconditionally. (Note that option <foo> is not put into effect by specifying <foo>: true or a similar form; note also that keywords need not be quoted.) Specifying the option keyword with a predicate function makes the option conditional on the predicate.

The argument list to the predicate function is always [level, direction, function, item] where level is the recursion level for the function, direction is either enter or exit, function is the name of the function, and item is the argument list (on entering) or the return value (on exiting).

Here is an example of unconditional trace options:

          (%i1) ff(n) := if equal(n, 0) then 1 else n * ff(n - 1)$

          (%i2) trace (ff)$

          (%i3) trace_options (ff, lisp_print, break)$

          (%i4) ff(3);

Here is the same function, with the break option conditional on a predicate:

          (%i5) trace_options (ff, break(pp))$

          (%i6) pp (level, direction, function, item) := block (print (item),
              return (function = ff and level = 3 and direction = exit))$

          (%i7) ff(6);

(%o1)                                true
(%i2) 

Trace_options Example

Related Examples

trace_options

? trace_options;

Calculate

trace_options

? trace_options;

Calculate