Guile Library

(debugging assert)

Overview

Defines an assert macro, and the cout and cerr utility functions.

Usage

assert doit (expr ...) (r-exp ...)
[Special Form]

Assert the truth of an expression (or of a sequence of expressions).

syntax: assert ?expr ?expr ... [report: ?r-exp ?r-exp ...]

If (and ?expr ?expr ...) evaluates to anything but #f, the result is the value of that expression. Otherwise, an error is reported.

The error message will show the failed expressions, as well as the values of selected variables (or expressions, in general). The user may explicitly specify the expressions whose values are to be printed upon assertion failure -- as ?r-exp that follow the identifier report:.

Typically, ?r-exp is either a variable or a string constant. If the user specified no ?r-exp, the values of variables that are referenced in ?expr will be printed upon the assertion failure.

cout . args
[Function]

Similar to cout << arguments << args, where argument can be any Scheme object. If it's a procedure (e.g. newline), it's called without args rather than printed.

cerr . args
[Function]

Similar to cerr << arguments << args, where argument can be any Scheme object. If it's a procedure (e.g. newline), it's called without args rather than printed.