XLISP trace

Nyquist / XLISP 2.0 - Contents | Tutorials | Examples | Reference

# trace

Type: | - | function (subr)
Source: | - | xlcont.c

## Syntax

(trace function ... )
  function - an unquoted function
  returns - the trace list

## Description

The 'trace' special form allows the tracing of user or system functions. 'trace' returns a list containing the current set of functions that are being traced. The 'function' does not have to be currently defined, it can be created as part of the execution. The trace output consists of entry and exit information.

At entry and exit of a traced 'function', lines will be printed of the form:

    Entering: function, Argument list: arg-list
    Exiting: function, Value: return-value

A list of all currently traced functions can be found in the *tracelist* system variable.

## Examples

    (defun foo (x) (print (car x)))  ; define FOO
    (trace 'foo)                     ; returns (FOO)
    (trace 'car)                     ; returns (CAR FOO)

    (foo '(a))                       ; Entering: FOO, Argument list: ((A))
                                     ;  Entering: CAR, Argument list: ((A))
                                     ;  Exiting: CAR, Value: A
                                     ; A
                                     ; Exiting: FOO, Value: A
                                     ; returns A

Common Lisp: The XLISP 'trace' function does not support any keyword options, which Common Lisp allows.

See the trace special form in the XLISP 2.0 manual.

Back to Top

Nyquist / XLISP 2.0 - Contents | Tutorials | Examples | Reference