proposed code revision for nformat: cleanup and extension



I have a file that replaces nformat.lisp, at
http://www.cs.berkeley.edu/~fateman/lisp/nformatx.lisp.

It has the following useful functionality, and seems to run in a modern
lisp (allegro common lisp) as well as GCL.  I suspect it will run
in all other lisps hosting maxima, but would like others to try it.

To test,
load it into a working maxima and type
interval(1,2).
you should get interval(1,2) returned.
type
?print(interval(1,2));
and you should see #s(ri lo 1 hi 2).

This change to nformat makes it possible to use, within the lisp under 
Maxima,
structures and objects that are not ordinarily supported because
Maxima is not skilled in allowing them to be entered in its ordinary form
or displayed.

I added "real intervals"   a structure   ri, to demonstrate.

The 3 lines to do this:

(defstruct (ri (:constructor $interval (lo hi) ))lo hi)

(setf (get 'ri 'formatter) ;; in case a structure of type ri [real 
interval] is computed
   #'(lambda(r) (list '($interval simp) (ri-lo r)(ri-hi r)))) ;; this 
helps prints it.

The nformat function has been rewritten to be data-directed, so that the 
formatting
of yet other forms can be simply added.

I have also changed the formatter to allow for common-lisp ratios and 
common-lisp
complex numbers.  These will now be displayed properly.  Some other 
functions
inside Maxima kind-of work with these guys, but not uniformly so..

I would like someone with CLISP and SBCL at least to try this code.

I will then be in a better position to release the interval arithmetic 
evaluation
code that works in Maxima without resorting to either (a) an embarrassingly
inefficient encoding of intervals  or (b) a kludge for input and display.

This revision of nformat is, I think, in all ways compatible and superior.

There is a little song-and-dance to accommodate both GCL and Allegro in that
a string "abc" is of type STRING in GCL but in Allegro is (SIMPLE-ARRAY 
CHARACTER(3))
For the uninitiated,  "abc"  is, along with arrays, and structures -- in 
lisp -- an atom.

RJF