documenting lisp source



Maxima itself is pretty well documented. If one wants to read source
code of particular Maxima functions, one finds stuff from the underlying
common lisp as well as functions defined on top of the underlying lisp.
It would be nice if there were documentation for the latter lisp functions
as well other than the source code itself.

For example, in following up on Wolfgang Jenkner's helpful suggestions
regarding algebraic number theory in Maxima, I was led to the files
numth.lisp and combin.lisp. In the latter, in a neighborhood of the
function qunit, which is apparently made available to Maxima by the
command DEFMFUN, the following functions are defined (or should I say
defun'd?):

(defun cfsqrt (n)
(DEFMFUN $qunit (n)
(defun pelso1 (l a b)
(defun sqcont (n)
(defun ratcf (x y)
(DEFMFUN $cfexpand (x)
(defun cfexpand (ll)

If I want to experiment with variations of the code, it would be nice to
know more about what they do. Apart from reading their definitions, one
possibility is to call these functions from Maxima and experiment with them.
According to an older posting of Boris Gaertner, and some examples he kindly
sent me, one can call them by prepending a question mark to the lisp functions
one wants to call. When I do this with sqcont, for example, the following
happens:

Maxima 5.9.0 http://maxima.sourceforge.net [...]
(C1) ?sqcont(2);

*** - GET: 1 is not a symbol
The following restarts are available:
R1 = Macsyma top-level

1. Break [1]> r1
Maxima restarted.
(C2) ?sqcont(sqrt(2));

*** - argument to * should be a number: (($ISQRT) ((MEXPT SIMP) 2 ((RAT SIMP) 1 2)))
The following restarts are available:
R1 = Macsyma top-level

1. Break [2]> r1
Maxima restarted.
(C3) ?describe(?sqcont);

SQCONT is the symbol SQCONT, lies in #, is accessible in the 
package MAXIMA, names a function.
 
 # is the package named MAXIMA. It has the nicknames MACSYMA, 
 CL-MAXIMA, CL-MACSYMA.
 It imports the external symbols of the packages SLOOP, COMMON-LISP, EXT and 
 exports no symbols, but no package uses these exports.
 
 # is a compiled function.
 Argument list: (ARG0).
 For more information, evaluate (DISASSEMBLE #'SQCONT).
(D3)					          FALSE
(C4) ?lispeval(disassemble #'sqcont);
(D4)				        LISPEVAL(disassemble # sqcont)
(C5) ?disassemble(?sqcont);


Disassembly of function SQCONT
(CONST 0) = N
(CONST 1) = Q
(CONST 2) = M
(CONST 3) = A
(CONST 4) = L
(CONST 5) = $ISQRT
(CONST 6) = 1
(CONST 7) = *DIF
(CONST 8) = 2
(CONST 9) = *QUO
1 required arguments
0 optional arguments
No rest parameter
No keyword parameters
0     (LOAD 1)
1     (BIND 0)                            ; N
3     (NIL)
4     (BIND 1)                            ; Q
6     (PUSH-NIL 2)
8     (NIL)
[rest of disassembly deleted]

I can see that I can have hours of fun with this, particularly since I don't
have much experience with CLISP, but it would be nice to be more deliberate
about it.

Incidentally, this disassembled code looks interesting. Where is this
"lisp assembly language" documented? I tried to grep the info files that
come with CLISP and found essentially nothing with the string assembl.
-- 
Ignorantly,
Allan Adler 
* Disclaimer: I am a guest and *not* a member of the MIT CSAIL. My actions and
* comments do not reflect in any way on MIT. Also, I am nowhere near Boston.