Up | Next | Tail |

When programming an application in symbolic mode, it may be necessary to report an exception to the user, e.g. if an algebraic prerequisite for applying the algorithm is not fulfilled. There are several routines for signalling an error in symbolic mode:

- The easiest way to complain about a bad algebraic form is to call typerr.
This function has two parameters typerr(exp,str): the first one is an
algebraic expression, the bad object, and the second one is a string which
describes what the object should have been. When printed REDUCE will
report exp in mathematical notation and insert a string “illegal as”. The
current program is terminated.
u := ’(plus x 1);

. . .

if not numberp u then typerr(u,"number"); - A general error can be reported using the function rederr; it prints some
asterisks and then its argument in pure LISP style (no mathematical
format); the argument can be a list - in that case the surrounding brackets
are omitted in output. The current program is terminated.
rederr "algorithm not applicable if denominator neq 1";

rederr {"never call me with ",u," again"}; - Similar to rederr the routine rerror terminates the run with an error
message; it has been designed for usage in a REDUCE package enabling the
error handler to localize the error reason and to provide additional
information to the end user (e.g. via a help system). It has 3 parameters:
rerror(pack,nbr,mess) where pack is the name of the package (usually
a quoted identifier), nbr is an integer error number local to the
package, beginning with 1 and mess is the error message just like
rederr.
rerror(’asys,13,"remainder not zero");
Wherever possible rerror should be used instead of rederr.

Up | Next | Front |