Comprehensive TeX Archive Network

Direc­tory web/spiderweb/src/reduce

REDUCE is a lisp based system for symbolic computation by A. Hearn.
The real lisp is hidden for the user by a pascal like language, called
rlisp, which is parsed and converted to ordinary lisp, when read. 
Due to the nature of lisp any expression that returns a value may
appear at almost any place, for instance

b:=for i:=1:if x then y else z sum a(i)+if c then d else e+
     while x do begin ...; return ...; ... end;

is a perfectly correct rlisp expression. REDUCE itself and all
available libraries are written in rlisp. Users can also write their
own packages in rlisp, containing both low and high level REDUCE

Besides the ordinary stuff available in almost any computer algebra
program, there are user written packages available for differential
geometry, determining symmetries of differential equations, lie
algebras etc., possibly using non standard data structures based on
lisp objects.

It will be clear from the rlisp expression given above that one has to
be very careful about what has to appear in math mode and what in text
mode. Moreover some additional indentation for complicated expressions
may be desirable. 
The second problem can be solved by carefully implementing the
production rules, the first one we solved by putting everything in
text mode except for the unary and binary operators like +, -, :=,
etc., and applying some tricks to get spaces that cannot be removed by
a cancel.

Changes necessary to weave and tangle in order to parse rlisp source
code correctly are the following:
- rlisp only knows one kind of string, namely the one surrounded by double
  quotes ", whereas a single quote ' is explicitly used as a 'quote'.
  This means that the parsing of strings had to be adapted.
- rlisp has an escape character '!', which means that an identifier
  may contain any character if it is preceded by an exclamation mark
  (in this way identifiers may even contain spaces), hence the parsing
  of identifiers had to be altered.
- we changed some things which seemed to be bugs: a) in the debug part of
  the weave code we replaced "\\{" by "\\\\{" since our compiler
  complained about it, b) "+\equiv" isn't TeX'ed in a very nice way so
  we replaced it by a new TeX macro "\PS" to be used for multiply
  defined modules.
- a minor change: we like tangle also to print the newlines in macros, so
  we #define'd NEWLINES_IN_MACROS.
- rlisp doesn't allow underscores to occur in identifiers, unless
  preceded by '!'. Therefore, we postprocess the tangled file in order
  to remove the underscores. Indeed this can also be done by changing
  tangle.web in the appropriate place, but I think it is more work to
  find the exact place where the change has to be made, than writing a
  C program that does a similar job. However, if you are more familiar
  with tangle than we are and know exactly where to make the change,
  feel free to do so (underscores preceded by '!' and in strings
  should stay).

Moreover, previewing the weaved & TeX'ed tangle I discovered what
seems to be a bug in your set of production rules of ceeweave, namely
'extern' followed by two simps seems to be missing a space, whereas
'extern' followed by one simp gives no problem.

I hope this 'blurb' about REDUCE and the necessary changes is
satisfactory. I have put all necessary files tarred, compressed and
uuencoded at the end of this mail. It is also available by anonymous
ftp from utmfu0.math.utwente.nl (

If you have comments or suggestions on our work, feel free to react.

Marcel Roelofs. 
Guest Book Sitemap Contact Contact Author