axiom-developer
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Axiom-developer] 20070903.01.tpd.patch


From: daly
Subject: [Axiom-developer] 20070903.01.tpd.patch
Date: Mon, 3 Sep 2007 18:25:14 -0500

The following patch is a continuation of the algebra documentation effort.

 o) adds or fixes )help documentation for the domains:

    Octonion.help (OCT)
    None.help (NONE)
    MultivariatePolynomial.help (MPOLY)
    Multiset.help (MSET)
    Matrix.help (MATRIX)
    MappingPackage3.help (MAPPKG3)
    MappingPackage2.help (MAPPKG2)
    MappingPackage1.help (MAPPKG1)
    MakeFunction.help (MKFUNC)
    Magma.help (MAGMA)
    LyndonWord.help (LWORD)
    List.help (LIST)
    Permutation.help (PERM)
    TwoDimensionalViewport.help (VIEW2D)
    PlaneAlgebraicCurvePlot.help (ACPLOT)
    OneDimensionalArray (ARRAY1)
    HexadecimalExpansion
    RomanNumeral

 o) fixes a typo in the Jenks book
   
    in src/doc/book MultiSet -> Multiset

 o) documents how to create )help file documentation
 o) documents how to create regression tests for algebra files

    in src/doc/bookvol4, Developers Guide
    in src/algebra/Makefile
    in src/input/Makefile

 o) removes and replaces the previous algebra testing stanzas

    in src/input/Makefile
    in src/algebra/perm.spad
    in src/algebra/view2d.spad
    in src/algebra/fr.spad


====================================================================
diff --git a/changelog b/changelog
index a8cf9d5..eeab935 100644
--- a/changelog
+++ b/changelog
@@ -1,3 +1,79 @@
+20070903 tpd src/algebra/radix.spad fix typos in help file
+20070903 tpd src/algebra/integer.spad fix typos in help file
+20070903 tpd src/doc/bookvol4 fix typos
+20070902 tpd src/doc/spadhelp add OneDimensionalArray
+20070902 tpd src/algebra/Makefile add OneDimensionalArray.help 
+20070902 tpd src/algebra/array1.spad add OneDimensionalArray.help (ARRAY1)
+20070902 tpd src/algebra/array1.spad OneDimensionalArray.input
+20070902 tpd src/doc/spadhelp add Octonion
+20070902 tpd src/algebra/Makefile add Octonion.help 
+20070902 tpd src/algebra/oct.spad add Octonion.help (OCT)
+20070902 tpd src/algebra/oct.spad Octonion.input
+20070902 tpd src/doc/spadhelp add None
+20070902 tpd src/algebra/Makefile add None.help 
+20070902 tpd src/algebra/any.spad add None.help (NONE)
+20070902 tpd src/algebra/any.spad None.input
+20070902 tpd src/doc/spadhelp add MultivariatePolynomial
+20070902 tpd src/algebra/Makefile add MultivariatePolynomial.help 
+20070902 tpd src/algebra/multpoly.spad add MultivariatePolynomial.help (MPOLY)
+20070902 tpd src/algebra/multpoly.spad MultivariatePolynomial.input
+20070902 tpd src/doc/spadhelp add Multiset
+20070902 tpd src/algebra/Makefile add Multiset.help 
+20070902 tpd src/algebra/mset.spad add Multiset.help (MSET)
+20070902 tpd src/algebra/mset.spad Multiset.input
+20070902 tpd src/doc/book MultiSet -> Multiset
+20070902 tpd src/doc/spadhelp add Matrix
+20070902 tpd src/algebra/Makefile add Matrix.help 
+20070902 tpd src/algebra/matrix.spad add Matrix.help (MATRIX)
+20070902 tpd src/algebra/matrix.spad Matrix.input
+20070902 tpd src/doc/bookvol4 document how to add help files
+20070902 tpd src/algebra/Makefile document how to add help files
+20070902 tpd src/doc/spadhelp add MappingPackage3
+20070902 tpd src/algebra/Makefile add MappingPackage3.help 
+20070902 tpd src/algebra/mappkg.spad add MappingPackage3.help (MAPPKG3)
+20070902 tpd src/algebra/mappkg.spad MappingPackage3.input
+20070902 tpd src/doc/spadhelp add MappingPackage2
+20070902 tpd src/algebra/Makefile add MappingPackage2.help 
+20070902 tpd src/algebra/mappkg.spad add MappingPackage2.help (MAPPKG2)
+20070902 tpd src/algebra/mappkg.spad MappingPackage2.input
+20070902 tpd src/doc/spadhelp add MappingPackage1
+20070902 tpd src/algebra/Makefile add MappingPackage1.help 
+20070902 tpd src/algebra/mappkg.spad add MappingPackage1.help (MAPPKG1)
+20070902 tpd src/algebra/mappkg.spad MappingPackage1.input
+20070902 tpd src/doc/spadhelp add MakeFunction
+20070902 tpd src/algebra/Makefile add MakeFunction.help 
+20070902 tpd src/algebra/mkfunc.spad add MakeFunction.help (MKFUNC)
+20070902 tpd src/algebra/mkfunc.spad MakeFunction.input
+20070902 tpd src/algebra/view2d.spad fix typos in help file
+20070902 tpd src/algebra/files.spad fix typos in help file
+20070902 tpd src/algebra/acplot.spad fix typos in help file
+20070902 tpd src/doc/spadhelp add Magma
+20070902 tpd src/algebra/Makefile add Magma.help 
+20070902 tpd src/algebra/xlpoly.spad add Magma.help (MAGMA)
+20070902 tpd src/algebra/xlpoly.spad Magma.input
+20070902 tpd src/doc/spadhelp add LyndonWord
+20070902 tpd src/algebra/Makefile add LyndonWord.help 
+20070902 tpd src/algebra/xlpoly.spad add LyndonWord.help (LWORD)
+20070902 tpd src/algebra/xlpoly.spad LyndonWord.input
+20070902 tpd src/doc/spadhelp add List
+20070902 tpd src/algebra/Makefile add List.help 
+20070902 tpd src/algebra/list.spad add List.help (LIST)
+20070902 tpd src/algebra/list.spad List.input
+20070901 tpd src/input/Makefile remove ALGEBRA variable
+20070901 tpd src/doc/spadhelp add Permutation
+20070901 tpd src/algebra/Makefile add Permutation.help 
+20070901 tpd src/algebra/acplot.spad add Permutation.help (PERM)
+20070901 tpd src/algebra/acplot.spad Permutation.input
+20070901 tpd src/doc/spadhelp add TwoDimensionalViewport
+20070901 tpd src/algebra/Makefile add TwoDimensionalViewport.help
+20070901 tpd src/algebra/view2d.spad add TwoDimensionalViewport.help (VIEW2D)
+20070901 tpd src/algebra/perm.spad remove TEST mechanism
+20070901 tpd src/algebra/view2d.spad remove TEST mechanism
+20070901 tpd src/algebra/fr.spad remove TEST mechanism
+20070901 tpd src/doc/spadhelp add PlaneAlgebraicCurvePlot
+20070901 tpd src/algebra/Makefile add PlaneAlgebraicCurvePlot.help 
+20070901 tpd src/algebra/acplot.spad add PlaneAlgebraicCurvePlot.help (ACPLOT)
+20070901 tpd src/algebra/acplot.spad PlaneAlgebraicCurvePlot.input
 20070901 tpd zips/aldor.20070901.tgz add pdf documentation
 20070901 tpd zips/aldor.20070901.tgz added
 20070901 tpd src/doc/spadhelp add RealSolvePackage
diff --git a/src/algebra/Makefile.pamphlet b/src/algebra/Makefile.pamphlet
index 9621c48..b011d80 100644
--- a/src/algebra/Makefile.pamphlet
+++ b/src/algebra/Makefile.pamphlet
@@ -1487,43 +1487,6 @@ DOCFILES= \
  ${DOC}/zerodim.spad.dvi
 
 @
-\section{Test Cases}
-<<environment>>=
-
-TESTS=${INPUT}/ACPLOT.input ${INPUT}/INTHEORY.input ${INPUT}/PERM.input \
-      ${INPUT}/TESTFR.input ${INPUT}/VIEW2D.input 
-
-@
-<<testrules>>=
-
-${INPUT}/ACPLOT.input: ${IN}/acplot.spad.pamphlet
-       @ echo making ${INPUT}/ACPLOT.input from ${IN}/acplot.spad.pamphlet
-       @(cd ${INPUT} ; \
-        ${TANGLE} -R"TEST ACPLOT" ${IN}/acplot.spad.pamphlet >ACPLOT.input )
-
-${INPUT}/TESTFR.input: ${IN}/fr.spad.pamphlet
-       @ echo making ${INPUT}/frtest.input from ${IN}/fr.spad.pamphlet
-       @(cd ${INPUT} ; \
-        ${TANGLE} -R"TEST FR" ${IN}/fr.spad.pamphlet >TESTFR.input )
-
-${INPUT}/INTHEORY.input: ${IN}/numtheor.spad.pamphlet
-       @ echo making ${INPUT}/INTHEORY.input from ${IN}/numtheor.spad.pamphlet
-       @(cd ${INPUT} ; \
-        ${TANGLE} -R"TEST INTHEORY" ${IN}/numtheor.spad.pamphlet \
-            >INTHEORY.input )
-
-${INPUT}/PERM.input: ${IN}/perm.spad.pamphlet
-       @ echo making ${INPUT}/PERM.input from ${IN}/perm.spad.pamphlet
-       @(cd ${INPUT} ; \
-        ${TANGLE} -R"TEST PERM" ${IN}/perm.spad.pamphlet \
-            >PERM.input )
-
-${INPUT}/VIEW2D.input: ${IN}/view2d.spad.pamphlet
-       @ echo making ${INPUT}/VIEW2D.input from ${IN}/view2d.spad.pamphlet
-       @(cd ${INPUT} ; \
-        ${TANGLE} -R"TEST VIEW2D" ${IN}/view2d.spad.pamphlet >VIEW2D.input )
-
-@
 \section{The Makefile Stanzas}
 A [[spad]] pamphlet can contain many Axiom [[categories]], [[domains]], and
 [[packages]]. 
@@ -2011,6 +1974,99 @@ layer23done:
        @ echo ==================================
 
 @
+\section{help command documentation}
+Axiom supports a )help command that takes a single argument.
+This argument is interpreted as the name of a flat ascii file
+which should live in \$AXIOM/doc/src/spadhelp.
+
+\subsection{help documentation for algebra}
+The help documentation for algebra files lives within the algebra
+pamphlet. The help chunk contains the name of the domain, thus:
+
+\begin{verbatim}
+<<thisdomain.help>>=
+====================================================================
+thisdomain examples
+====================================================================
+
+   (documentation for this domain)
+
+  examplefunction foo
+   output
+                Type: thetype
+
+See Also:
+o )show thisdomain
+o $AXIOM/bin/src/doc/algebra/thisfile.spad.dvi
+
+@
+\end{verbatim}
+
+The documentation starts off with the domain enclosed in two lines
+of equal signs. The documentation is free format. Generally the
+functions are indented two spaces, the output is indented 3 spaces,
+and the Type field has been moved toward the center of the line.
+
+The ``See Also:'' section lists the domain with the ``show'' command
+and the path to the source file in dvi format.
+
+\subsection{adding help documentation in Makefile}
+
+There is a section in the src/algebra/Makefile.pamphlet that reads:
+\begin{verbatim}
+SPADHELP=\
+ ${HELP}/AssociationList.help  ${HELP}/BalancedBinaryTree.help \
+\end{verbatim}
+which is essentially a list of all of the algebra help files. Each item
+in this list refers to a stanza that looks like:
+
+\begin{verbatim}
+${HELP}/AssociationList.help: ${IN}/list.spad.pamphlet
+       @echo 7000 create AssociationList.help from ${IN}/list.spad.pamphlet
+       @${TANGLE} -R"AssociationList.help" ${IN}/list.spad.pamphlet \
+            >${HELP}/AssociationList.help
+       @cp ${HELP}/AssociationList.help ${HELP}/ALIST.help
+       @${TANGLE} -R"AssociationList.input" ${IN}/list.spad.pamphlet \
+            >${INPUT}/AssociationList.input
+\end{verbatim}
+
+Notice that the first line has an connection between the help file and 
+the spad file that contains it. The second line gives debugging output
+containing a unique number. The third line extracts the help file. The
+fourth line copies the file with the long name of the domain to a file
+with the abbreviation of the domain so the user can query the domain
+with either form.
+
+\subsection{Using help documentation for regression testing}
+
+The last line extracts an input test file for the algebra. In general
+each help file is used to create an input test file for regression testing.
+
+There is a Makefile variable called REGRESS in the algebra Makefile:
+\begin{verbatim}
+REGRESS=\
+ AssociationList.regress  BalancedBinaryTree.regress \
+\end{verbatim}
+
+This is part of a Makefile that structure within the algebra Makefile.
+This Makefile gets extracted by the Makefile in the input subdirectory.
+Thus there is a connection between the two Makefiles (algebra and input).
+This algebra regression Makefile goes by the chunk name 
+{\bf algebra.regress}. It contains a list of regression files and a 
+single stanza:
+\begin{verbatim}
+%.regress: %.input
+       @ echo algebra regression testing $*
+       @ rm -f $*.output
+       @ echo ')read $*.input' | ${TESTSYS} 
+       @ echo ')lisp (regress "$*.output")' | ${TESTSYS} \
+                | egrep -v '(Timestamp|Version)' | tee $*.regress
+\end{verbatim}
+The input Makefile extracts {\bf algebra.regress} and then calls 
+make to process this file.
+
+This keeps the regression test list in the algebra Makefile.
+
 <<environment>>=
 SPADHELP=\
  ${HELP}/AssociationList.help  ${HELP}/BalancedBinaryTree.help \
@@ -2035,9 +2091,18 @@ SPADHELP=\
  ${HELP}/LiePolynomial.help   \
  ${HELP}/LinearOrdinaryDifferentialOperator.help \
  ${HELP}/LinearOrdinaryDifferentialOperator1.help \
- ${HELP}/LinearOrdinaryDifferentialOperator2.help \
+ ${HELP}/LinearOrdinaryDifferentialOperator2.help ${HELP}/List.help \
+ ${HELP}/LyndonWord.help       ${HELP}/Magma.help \
+ ${HELP}/MakeFunction.help     ${HELP}/MappingPackage1.help \
+ ${HELP}/MappingPackage2.help  ${HELP}/MappingPackage3.help \
+ ${HELP}/Matrix.help           ${HELP}/Multiset.help \
+ ${HELP}/MultivariatePolynomial.help ${HELP}/None.help \
+ ${HELP}/Octonion.help         ${HELP}/OneDimensionalArray.help \
+ ${HELP}/PlaneAlgebraicCurvePlot.help \
+ ${HELP}/Permutation.help \
  ${HELP}/RealSolvePackage.help \
- ${HELP}/RomanNumeral.help
+ ${HELP}/RomanNumeral.help \
+ ${HELP}/TwoDimensionalViewport.help
 
 @
 The algebra files contain input chunks in regress format.
@@ -2070,9 +2135,20 @@ REGRESS=\
  LieExponentials.regress  LiePolynomial.regress \
  LinearOrdinaryDifferentialOperator.regress \
  LinearOrdinaryDifferentialOperator1.regress \
- LinearOrdinaryDifferentialOperator2.regress \
+ LinearOrdinaryDifferentialOperator2.regress List.regress \
+ LyndonWord.regress        Magma.regress \
+ MakeFunction.regress      MappingPackage1.regress \
+ MappingPackage2.regress   MappingPackage3.regress \
+ Matrix.regress            Multiset.regress \
+ MultivariatePolynomial.regress None.regress \
+ Octonion.regress          OneDimensionalArray.regress \
  RealSolvePackage.regress \
- RomanNumeral.regress
+ PlaneAlgebraicCurvePlot.regress \
+ Permutation.regress \
+ RomanNumeral.regress 
+
+# this requires graphics
+# TwoDimensionalViewport
 
 %.regress: %.input
        @ echo algebra regression testing $*
@@ -2446,8 +2522,133 @@ ${HELP}/LinearOrdinaryDifferentialOperator2.help: 
${IN}/lodo.spad.pamphlet
            ${IN}/lodo.spad.pamphlet \
             >${INPUT}/LinearOrdinaryDifferentialOperator2.input
 
+${HELP}/List.help: ${IN}/list.spad.pamphlet
+       @echo 7040 create List.help from ${IN}/list.spad.pamphlet
+       @${TANGLE} -R"List.help" ${IN}/list.spad.pamphlet \
+           >${HELP}/List.help
+       @cp ${HELP}/List.help ${HELP}/LIST.help
+       @${TANGLE} -R"List.input" ${IN}/list.spad.pamphlet \
+            >${INPUT}/List.input
+
+${HELP}/LyndonWord.help: ${IN}/xlpoly.spad.pamphlet
+       @echo 7041 create LyndonWord.help from ${IN}/xlpoly.spad.pamphlet
+       @${TANGLE} -R"LyndonWord.help" ${IN}/xlpoly.spad.pamphlet \
+            >${HELP}/LyndonWord.help
+       @cp ${HELP}/LyndonWord.help ${HELP}/LWORD.help
+       @${TANGLE} -R"LyndonWord.input" ${IN}/xlpoly.spad.pamphlet \
+            >${INPUT}/LyndonWord.input
+
+${HELP}/Magma.help: ${IN}/xlpoly.spad.pamphlet
+       @echo 7042 create Magma.help from ${IN}/xlpoly.spad.pamphlet
+       @${TANGLE} -R"Magma.help" ${IN}/xlpoly.spad.pamphlet \
+            >${HELP}/Magma.help
+       @cp ${HELP}/Magma.help ${HELP}/MAGMA.help
+       @${TANGLE} -R"Magma.input" ${IN}/xlpoly.spad.pamphlet \
+            >${INPUT}/Magma.input
+
+${HELP}/MakeFunction.help: ${IN}/mkfunc.spad.pamphlet
+       @echo 7043 create MakeFunction.help from ${IN}/mkfunc.spad.pamphlet
+       @${TANGLE} -R"MakeFunction.help" ${IN}/mkfunc.spad.pamphlet \
+           >${HELP}/MakeFunction.help
+       @cp ${HELP}/MakeFunction.help ${HELP}/MKFUNC.help
+       @${TANGLE} -R"MakeFunction.input" ${IN}/mkfunc.spad.pamphlet \
+            >${INPUT}/MakeFunction.input
+
+${HELP}/MappingPackage1.help: ${IN}/mappkg.spad.pamphlet
+       @echo 7044 create MappingPackage1.help from ${IN}/mappkg.spad.pamphlet
+       @${TANGLE} -R"MappingPackage1.help" ${IN}/mappkg.spad.pamphlet \
+           >${HELP}/MappingPackage1.help
+       @cp ${HELP}/MappingPackage1.help ${HELP}/MAPPKG1.help
+       @${TANGLE} -R"MappingPackage1.input" ${IN}/mappkg.spad.pamphlet \
+            >${INPUT}/MappingPackage1.input
+
+${HELP}/MappingPackage2.help: ${IN}/mappkg.spad.pamphlet
+       @echo 7045 create MappingPackage2.help from ${IN}/mappkg.spad.pamphlet
+       @${TANGLE} -R"MappingPackage2.help" ${IN}/mappkg.spad.pamphlet \
+           >${HELP}/MappingPackage2.help
+       @cp ${HELP}/MappingPackage2.help ${HELP}/MAPPKG2.help
+       @${TANGLE} -R"MappingPackage2.input" ${IN}/mappkg.spad.pamphlet \
+            >${INPUT}/MappingPackage2.input
+
+${HELP}/MappingPackage3.help: ${IN}/mappkg.spad.pamphlet
+       @echo 7046 create MappingPackage3.help from ${IN}/mappkg.spad.pamphlet
+       @${TANGLE} -R"MappingPackage3.help" ${IN}/mappkg.spad.pamphlet \
+           >${HELP}/MappingPackage3.help
+       @cp ${HELP}/MappingPackage3.help ${HELP}/MAPPKG3.help
+       @${TANGLE} -R"MappingPackage3.input" ${IN}/mappkg.spad.pamphlet \
+            >${INPUT}/MappingPackage3.input
+
+${HELP}/Matrix.help: ${IN}/matrix.spad.pamphlet
+       @echo 7047 create Matrix.help from ${IN}/matrix.spad.pamphlet
+       @${TANGLE} -R"Matrix.help" ${IN}/matrix.spad.pamphlet \
+           >${HELP}/Matrix.help
+       @cp ${HELP}/Matrix.help ${HELP}/MATRIX.help
+       @${TANGLE} -R"Matrix.input" ${IN}/matrix.spad.pamphlet \
+            >${INPUT}/Matrix.input
+
+${HELP}/Multiset.help: ${IN}/mset.spad.pamphlet
+       @echo 7048 create Multiset.help from ${IN}/mset.spad.pamphlet
+       @${TANGLE} -R"Multiset.help" ${IN}/mset.spad.pamphlet \
+           >${HELP}/Multiset.help
+       @cp ${HELP}/Multiset.help ${HELP}/MSET.help
+       @${TANGLE} -R"Multiset.input" ${IN}/mset.spad.pamphlet \
+            >${INPUT}/Multiset.input
+
+${HELP}/MultivariatePolynomial.help: ${IN}/multpoly.spad.pamphlet
+       @echo 7049 create MultivariatePolynomial.help from \
+           ${IN}/multpoly.spad.pamphlet
+       @${TANGLE} -R"MultivariatePolynomial.help" \
+           ${IN}/multpoly.spad.pamphlet \
+           >${HELP}/MultivariatePolynomial.help
+       @cp ${HELP}/MultivariatePolynomial.help ${HELP}/MPOLY.help
+       @${TANGLE} -R"MultivariatePolynomial.input" \
+            ${IN}/multpoly.spad.pamphlet \
+            >${INPUT}/MultivariatePolynomial.input
+
+${HELP}/None.help: ${IN}/any.spad.pamphlet
+       @echo 7050 create None.help from ${IN}/any.spad.pamphlet
+       @${TANGLE} -R"None.help" ${IN}/any.spad.pamphlet >${HELP}/None.help
+       @cp ${HELP}/None.help ${HELP}/NONE.help
+       @${TANGLE} -R"None.input" ${IN}/any.spad.pamphlet >${INPUT}/None.input
+
+${HELP}/Octonion.help: ${IN}/oct.spad.pamphlet
+       @echo 7051 create Octonion.help from ${IN}/oct.spad.pamphlet
+       @${TANGLE} -R"Octonion.help" ${IN}/oct.spad.pamphlet \
+           >${HELP}/Octonion.help
+       @cp ${HELP}/Octonion.help ${HELP}/OCT.help
+       @${TANGLE} -R"Octonion.input" ${IN}/oct.spad.pamphlet \
+            >${INPUT}/Octonion.input
+
+${HELP}/OneDimensionalArray.help: ${IN}/array1.spad.pamphlet
+       @echo 7052 create OneDimensionalArray.help from \
+           ${IN}/array1.spad.pamphlet
+       @${TANGLE} -R"OneDimensionalArray.help" ${IN}/array1.spad.pamphlet \
+           >${HELP}/OneDimensionalArray.help
+       @cp ${HELP}/OneDimensionalArray.help ${HELP}/ARRAY1.help
+       @${TANGLE} -R"OneDimensionalArray.input" ${IN}/array1.spad.pamphlet \
+            >${INPUT}/OneDimensionalArray.input
+
+${HELP}/PlaneAlgebraicCurvePlot.help: ${IN}/acplot.spad.pamphlet
+       @echo 7053 create PlaneAlgebraicCurvePlot.help from \
+            ${IN}/acplot.spad.pamphlet
+       @${TANGLE} -R"PlaneAlgebraicCurvePlot.help" \
+          ${IN}/acplot.spad.pamphlet \
+           >${HELP}/PlaneAlgebraicCurvePlot.help
+       @cp ${HELP}/PlaneAlgebraicCurvePlot.help ${HELP}/ACPLOT.help
+       @${TANGLE} -R"PlaneAlgebraicCurvePlot.input" \
+           ${IN}/acplot.spad.pamphlet \
+            >${INPUT}/PlaneAlgebraicCurvePlot.input
+
+${HELP}/Permutation.help: ${IN}/perm.spad.pamphlet
+       @echo 7054 create Permutation.help from ${IN}/perm.spad.pamphlet
+       @${TANGLE} -R"Permutation.help" ${IN}/perm.spad.pamphlet \
+           >${HELP}/Permutation.help
+       @cp ${HELP}/Permutation.help ${HELP}/PERM.help
+       @${TANGLE} -R"Permutation.input" ${IN}/perm.spad.pamphlet \
+            >${INPUT}/Permutation.input
+
 ${HELP}/RealSolvePackage.help: ${IN}/acplot.spad.pamphlet
-       @echo 7040 create RealSolvePackage.help from ${IN}/acplot.spad.pamphlet
+       @echo 7055 create RealSolvePackage.help from ${IN}/acplot.spad.pamphlet
        @${TANGLE} -R"RealSolvePackage.help" ${IN}/acplot.spad.pamphlet \
            >${HELP}/RealSolvePackage.help
        @cp ${HELP}/RealSolvePackage.help ${HELP}/REALSOLV.help
@@ -2455,13 +2656,22 @@ ${HELP}/RealSolvePackage.help: 
${IN}/acplot.spad.pamphlet
             >${INPUT}/RealSolvePackage.input
 
 ${HELP}/RomanNumeral.help: ${IN}/integer.spad.pamphlet
-       @echo 7041 create RomanNumeral.help from ${IN}/integer.spad.pamphlet
+       @echo 7056 create RomanNumeral.help from ${IN}/integer.spad.pamphlet
        @${TANGLE} -R"RomanNumeral.help" ${IN}/integer.spad.pamphlet \
            >${HELP}/RomanNumeral.help
        @cp ${HELP}/RomanNumeral.help ${HELP}/ROMAN.help
        @${TANGLE} -R"RomanNumeral.input" ${IN}/integer.spad.pamphlet \
             >${INPUT}/RomanNumeral.input
 
+${HELP}/TwoDimensionalViewport.help: ${IN}/view2d.spad.pamphlet
+       @echo 7057 create TwoDimensionalViewport.help from \
+           ${IN}/view2d.spad.pamphlet
+       @${TANGLE} -R"TwoDimensionalViewport.help" \
+           ${IN}/view2d.spad.pamphlet \
+           >${HELP}/TwoDimensionalViewport.help 
+       @cp ${HELP}/TwoDimensionalViewport.help ${HELP}/VIEW2D.help
+# Note:no input regression file due to graphics
+
 @
 
 \section{The Makefile}
@@ -2499,7 +2709,7 @@ ${HELP}/RomanNumeral.help: ${IN}/integer.spad.pamphlet
 <<USERLAYER>>
 <<order>>
 
-all: src ${OUT}/libdb.text ${DOCFILES} ${TESTS} ${SPADBIN}/index.html \
+all: src ${OUT}/libdb.text ${DOCFILES} ${SPADBIN}/index.html \
         ${SPADHELP}
        @ echo 4302 finished ${IN}
 
@@ -2539,7 +2749,6 @@ document: ${DOCFILES}
 <<genericRules>>
 
 <<spadhelp>>
-<<testrules>>
 <<ps (DOC from SRC)>>
 <<libdb.text (OUT from IN)>>
 <<stages>>
diff --git a/src/algebra/acplot.spad.pamphlet b/src/algebra/acplot.spad.pamphlet
index dfef292..b43e587 100644
--- a/src/algebra/acplot.spad.pamphlet
+++ b/src/algebra/acplot.spad.pamphlet
@@ -130,6 +130,10 @@ ans3 := realSolve(lp,lsv,0.01)$REALSOLV
 )lisp (bye)
 @
 <<RealSolvePackage.help>>=
+====================================================================
+RealSolvePackage examples
+====================================================================
+
   p := 4*x^3 - 3*x^2 + 2*x - 4
 
   ans1 := solve(p,0.01)$REALSOLV
@@ -212,25 +216,31 @@ RealSolvePackage(): _
 
 @
 \section{domain ACPLOT PlaneAlgebraicCurvePlot}
-\subsection{acplot input}
-<<TEST ACPLOT>>=
-makeSketch(x+y,x,y,-1/2..1/2,-1/2..1/2)
+<<PlaneAlgebraicCurvePlot.input>>=
+-- acplot.spad.pamphlet PlaneAlgebraicCurvePlot.input
+--S 1 of 1
+makeSketch(x+y,x,y,-1/2..1/2,-1/2..1/2)$ACPLOT
+--R   (1)                    ACPLOT
+--R                       1         1      1         1
+--R        y + x = 0,   - - <= x <= -,   - - <= y <= -
+--R                       2         2      2         2
+--R                        [0.5,-0.5]
+--R                        [-0.5,0.5]
+--R                                                Type: 
PlaneAlgebraicCurvePlot
+--E 1
 @
-\subsection{acplot examples}
-<<acplot.examples>>=
-\spadcommand{makeSketch(x+y,x,y,-1/2..1/2,-1/2..1/2)}
-$$
-\begin{array}{c}ACPLOT\\{\begin{array}{c}{{y+x}
-\mbox{\rm = 0} \mbox{\rm , } -{1 \over 2} \mbox{\rm <= } x \mbox{\rm <= } {1 
-\over 2} \mbox{\rm , } -{1 \over 2} \mbox{\rm <= } y \mbox{\rm <= } {1 \over 
-2}}\\{\begin{array}{c}{\begin{array}{c}{\left[ {0.5}, \: -{0.5} 
-\right]}\\{\left[
--{0.5}, \: {0.5} 
-\right]}\\\end{array}}\\\end{array}}\\\end{array}}\\\end{array}
-$$
-\returnType{Type: PlaneAlgebraicCurvePlot}
+<<PlaneAlgebraicCurvePlot.help>>=
+====================================================================
+PlaneAlgebraicCurvePlot examples
+====================================================================
+
+  makeSketch(x+y,x,y,-1/2..1/2,-1/2..1/2)$ACPLOT
+
+See Also:
+o )show PlaneAlgebraicCurvePlot
+o $AXIOM/doc/src/algebra/acplot.spad.dvi 
+
 @
-\subsection{acplot code}
 <<domain ACPLOT PlaneAlgebraicCurvePlot>>=
 --% PlaneAlgebraicCurvePlot
 ++ Plot a NON-SINGULAR plane algebraic curve p(x,y) = 0.
diff --git a/src/algebra/any.spad.pamphlet b/src/algebra/any.spad.pamphlet
index cabeec6..ef2f1b9 100644
--- a/src/algebra/any.spad.pamphlet
+++ b/src/algebra/any.spad.pamphlet
@@ -10,6 +10,72 @@
 \tableofcontents
 \eject
 \section{domain NONE None}
+<<None.input>>=
+-- any.spad.pamphlet None.input
+)spool None.output
+)set message test on
+)set message auto off
+)clear all
+--S 1 of 3
+[ ]
+--R 
+--R
+--R   (1)  []
+--R                                                              Type: List 
None
+--E 1
+
+--S 2 of 3
+[ ] :: List Float
+--R 
+--R
+--R   (2)  []
+--R                                                             Type: List 
Float
+--E 2
+
+--S 3 of 3
+[ ]$List(NonNegativeInteger)
+--R 
+--R
+--R   (3)  []
+--R                                                Type: List 
NonNegativeInteger
+--E 3 
+)spool
+)lisp (bye)
+@
+<<None.help>>=
+====================================================================
+None examples
+====================================================================
+
+The None domain is not very useful for interactive work but it is
+provided nevertheless for completeness of the Axiom type system.
+
+Probably the only place you will ever see it is if you enter an
+empty list with no type information.
+
+  [ ]
+    []
+                         Type: List None
+
+Such an empty list can be converted into an empty list of any other
+type.
+
+  [ ] :: List Float
+    []
+                         Type: List Float
+
+If you wish to produce an empty list of a particular type directly,
+such as List NonNegativeInteger, do it this way.
+
+  [ ]$List(NonNegativeInteger)
+    []
+                         Type: List NonNegativeInteger
+
+See Also:
+o )show None
+o $AXIOM/doc/src/algebra/any.spad.dvi
+
+@
 <<domain NONE None>>=
 )abbrev domain NONE None
 ++ Author:
diff --git a/src/algebra/array1.spad.pamphlet b/src/algebra/array1.spad.pamphlet
index 8c9e4af..10456d7 100644
--- a/src/algebra/array1.spad.pamphlet
+++ b/src/algebra/array1.spad.pamphlet
@@ -748,6 +748,162 @@ IndexedOneDimensionalArray(S:Type, mn:Integer):
 
 @
 \section{domain ARRAY1 OneDimensionalArray}
+<<OneDimensionalArray.input>>=
+-- array1.spad.pamphlet OneDimensionalArray.input
+)spool OneDimensionalArray.output
+)set message test on
+)set message auto off
+)clear all
+--S 1 of 9
+oneDimensionalArray [i**2 for i in 1..10]
+--R 
+--R
+--R   (1)  [1,4,9,16,25,36,49,64,81,100]
+--R                                    Type: OneDimensionalArray 
PositiveInteger
+--E 1
+
+--S 2 of 9
+a : ARRAY1 INT := new(10,0)
+--R 
+--R
+--R   (2)  [0,0,0,0,0,0,0,0,0,0]
+--R                                            Type: OneDimensionalArray 
Integer
+--E 2
+
+--S 3 of 9
+for i in 1..10 repeat a.i := i; a
+--R 
+--R
+--R   (3)  [1,2,3,4,5,6,7,8,9,10]
+--R                                            Type: OneDimensionalArray 
Integer
+--E 3
+
+--S 4 of 9
+map!(i +-> i ** 2,a); a
+--R 
+--R
+--R   (4)  [1,4,9,16,25,36,49,64,81,100]
+--R                                            Type: OneDimensionalArray 
Integer
+--E 4
+
+--S 5 of 9
+reverse! a
+--R 
+--R
+--R   (5)  [100,81,64,49,36,25,16,9,4,1]
+--R                                            Type: OneDimensionalArray 
Integer
+--E 5
+
+--S 6 of 9
+swap!(a,4,5); a
+--R 
+--R
+--R   (6)  [100,81,64,36,49,25,16,9,4,1]
+--R                                            Type: OneDimensionalArray 
Integer
+--E 6
+
+--S 7 of 9
+sort! a 
+--R 
+--R
+--R   (7)  [1,4,9,16,25,36,49,64,81,100]
+--R                                            Type: OneDimensionalArray 
Integer
+--E 7
+
+--S 8 of 9
+b := a(6..10)
+--R 
+--R
+--R   (8)  [36,49,64,81,100]
+--R                                            Type: OneDimensionalArray 
Integer
+--E 8
+
+--S 9 of 9
+copyInto!(a,b,1)
+--R 
+--R
+--R   (9)  [36,49,64,81,100,36,49,64,81,100]
+--R                                            Type: OneDimensionalArray 
Integer
+--E 9
+)spool
+)lisp (bye)
+@
+<<OneDimensionalArray.help>>=
+====================================================================
+OneDimensionalArray examples
+====================================================================
+
+The OneDimensionalArray domain is used for storing data in a
+one-dimensional indexed data structure.  Such an array is a
+homogeneous data structure in that all the entries of the array must
+belong to the same Axiom domain.  Each array has a fixed length
+specified by the user and arrays are not extensible.  The indexing of
+one-dimensional arrays is one-based.  This means that the "first"
+element of an array is given the index 1. 
+
+To create a one-dimensional array, apply the operation 
+oneDimensionalArray to a list.
+
+  oneDimensionalArray [i**2 for i in 1..10]
+    [1,4,9,16,25,36,49,64,81,100]
+                     Type: OneDimensionalArray PositiveInteger
+
+Another approach is to first create a, a one-dimensional array of 10
+0's.  OneDimensionalArray has the convenient abbreviation ARRAY1.
+
+  a : ARRAY1 INT := new(10,0)
+    [0,0,0,0,0,0,0,0,0,0]
+                     Type: OneDimensionalArray Integer
+
+Set each i-th element to i, then display the result.
+
+  for i in 1..10 repeat a.i := i; a
+    [1,2,3,4,5,6,7,8,9,10]
+                     Type: OneDimensionalArray Integer
+
+Square each element by mapping the function i +-> i^2 onto each element.
+
+  map!(i +-> i ** 2,a); a
+    [1,4,9,16,25,36,49,64,81,100]
+                     Type: OneDimensionalArray Integer
+
+Reverse the elements in place.
+
+  reverse! a
+    [100,81,64,49,36,25,16,9,4,1]
+                     Type: OneDimensionalArray Integer
+
+Swap the 4th and 5th element.
+
+  swap!(a,4,5); a
+    [100,81,64,36,49,25,16,9,4,1]
+                     Type: OneDimensionalArray Integer
+
+Sort the elements in place.
+
+  sort! a 
+    [1,4,9,16,25,36,49,64,81,100]
+                     Type: OneDimensionalArray Integer
+
+Create a new one-dimensional array b containing the last 5 elements of a.
+
+  b := a(6..10)
+    [36,49,64,81,100]
+                     Type: OneDimensionalArray Integer
+
+Replace the first 5 elements of a with those of b.
+
+  copyInto!(a,b,1)
+    [36,49,64,81,100,36,49,64,81,100]
+                     Type: OneDimensionalArray Integer
+
+See Also:
+o )help Vector
+o )help FlexibleArray
+o )show OneDimensionalArray
+o $AXIOM/doc/src/algebra/array1.spad.dvi
+
+@
 <<domain ARRAY1 OneDimensionalArray>>=
 )abbrev domain ARRAY1 OneDimensionalArray
 ++ This is the domain of 1-based one dimensional arrays
diff --git a/src/algebra/files.spad.pamphlet b/src/algebra/files.spad.pamphlet
index 184ab3e..ec29146 100644
--- a/src/algebra/files.spad.pamphlet
+++ b/src/algebra/files.spad.pamphlet
@@ -573,8 +573,9 @@ members ey
 )lisp (bye)
 @
 <<KeyedAccessFile.help>>=
-\section{KeyedAccessFile}
-\label{KeyedAccessFileXmpPage}
+====================================================================
+KeyedAccessFile examples
+====================================================================
 
 The domain KeyedAccessFile(S) provides files which can be used
 as associative tables.  Data values are stored in these files and can
diff --git a/src/algebra/fr.spad.pamphlet b/src/algebra/fr.spad.pamphlet
index 5bf65c4..ad4853a 100644
--- a/src/algebra/fr.spad.pamphlet
+++ b/src/algebra/fr.spad.pamphlet
@@ -1056,10 +1056,9 @@ Note that up to [[patch--40]] the following wrong 
definition was used:
 \end{verbatim}
 
 which causes wrong results as soon as units are involved, for example in 
-
-<<TEST FR>>=
+\begin{verbatim}
   D(factor (-x), x)
-@
+\end{verbatim}
 
 (Issue~\#176)
 
diff --git a/src/algebra/integer.spad.pamphlet 
b/src/algebra/integer.spad.pamphlet
index bb76998..b5e56d2 100644
--- a/src/algebra/integer.spad.pamphlet
+++ b/src/algebra/integer.spad.pamphlet
@@ -1487,6 +1487,10 @@ b rem a
 @
 
 <<RomanNumeral.help>>=
+====================================================================
+RomanNumeral Examples
+====================================================================
+
   a := roman(78)
     LXXVIII
                       Type: RomanNumeral
diff --git a/src/algebra/list.spad.pamphlet b/src/algebra/list.spad.pamphlet
index 1c534e9..4292df0 100644
--- a/src/algebra/list.spad.pamphlet
+++ b/src/algebra/list.spad.pamphlet
@@ -307,6 +307,565 @@ Note that this code is not included in the generated 
catdef.spad file.
 (MAKEPROP (QUOTE |IndexedList|) (QUOTE |infovec|) (LIST (QUOTE #(NIL NIL NIL 
NIL NIL NIL (|local| |#1|) (|local| |#2|) (|NonNegativeInteger|) 
|ILIST;#;$Nni;1| |ILIST;concat;S2$;2| (|Boolean|) |ILIST;eq?;2$B;3| 
|ILIST;first;$S;4| (QUOTE "first") |ILIST;elt;$firstS;5| |ILIST;empty;$;6| 
|ILIST;empty?;$B;7| |ILIST;rest;2$;8| (QUOTE "rest") |ILIST;elt;$rest$;9| 
|ILIST;setfirst!;$2S;10| |ILIST;setelt;$first2S;11| |ILIST;setrest!;3$;12| 
|ILIST;setelt;$rest2$;13| (|List| 6) |ILIST;construct;L$;14| 
|ILIST;parts;$L;15| |ILIST;reverse!;2$;16| |ILIST;reverse;2$;17| (|Integer|) 
|ILIST;minIndex;$I;18| |ILIST;rest;$Nni$;19| (0 . |cyclic?|) |ILIST;copy;2$;20| 
(5 . |cycleEntry|) (|OutputForm|) (10 . |coerce|) (|List| |$|) (15 . |bracket|) 
(|List| 36) (20 . |list|) (25 . |commaSeparate|) (30 . |overbar|) (35 . 
|concat!|) (41 . |coerce|) (46 . |=|) (52 . |=|) (|String|) (58 . |latex|) (63 
. |latex|) (68 . |member?|) |ILIST;concat!;3$;25| (74 . |removeDuplicates!|) 
(|Mapping| 11 6 6) |ILIST;so!
rt!;M2$;27| |ILIST;merge!;M3$;28| |ILIST;split!;$I$;29| (|Mapping| 6 6 6) 
(|Equation| 6) (|List| 59) (|Mapping| 11 6) (|Void|) (|UniversalSegment| 30) 
(QUOTE "last") (QUOTE "value") (|Mapping| 6 6) (|InputForm|) (|SingleInteger|) 
(|List| 30) (|Union| 6 (QUOTE "failed")))) (QUOTE #(|~=| 79 |value| 85 |third| 
90 |tail| 95 |swap!| 100 |split!| 107 |sorted?| 113 |sort!| 124 |sort| 135 
|size?| 146 |setvalue!| 152 |setrest!| 158 |setlast!| 164 |setfirst!| 170 
|setelt| 176 |setchildren!| 218 |select!| 224 |select| 230 |second| 236 
|sample| 241 |reverse!| 245 |reverse| 250 |rest| 255 |removeDuplicates!| 266 
|removeDuplicates| 271 |remove!| 276 |remove| 288 |reduce| 300 |qsetelt!| 321 
|qelt| 328 |possiblyInfinite?| 334 |position| 339 |parts| 358 |nodes| 363 
|node?| 368 |new| 374 |more?| 380 |minIndex| 386 |min| 391 |merge!| 397 |merge| 
410 |members| 423 |member?| 428 |maxIndex| 434 |max| 439 |map!| 445 |map| 451 
|list| 464 |less?| 469 |leaves| 475 |leaf?| 480 |latex| 485 |last| 490 |!
insert!| 501 |insert| 515 |indices| 529 |index?| 534 |hash| 5!
40 |first| 545 |find| 556 |fill!| 562 |explicitlyFinite?| 568 |every?| 573 
|eval| 579 |eq?| 605 |entry?| 611 |entries| 617 |empty?| 622 |empty| 627 |elt| 
631 |distance| 674 |delete!| 680 |delete| 692 |cyclic?| 704 |cycleTail| 709 
|cycleSplit!| 714 |cycleLength| 719 |cycleEntry| 724 |count| 729 |copyInto!| 
741 |copy| 748 |convert| 753 |construct| 758 |concat!| 763 |concat| 775 
|coerce| 798 |children| 803 |child?| 808 |any?| 814 |>=| 820 |>| 826 |=| 832 
|<=| 838 |<| 844 |#| 850)) (QUOTE ((|shallowlyMutable| . 0) (|finiteAggregate| 
. 0))) (CONS (|makeByteWordVec2| 7 (QUOTE (0 0 0 0 0 0 0 0 0 0 3 0 0 7 4 0 0 7 
1 2 4))) (CONS (QUOTE #(|ListAggregate&| |StreamAggregate&| 
|ExtensibleLinearAggregate&| |FiniteLinearAggregate&| 
|UnaryRecursiveAggregate&| |LinearAggregate&| |RecursiveAggregate&| 
|IndexedAggregate&| |Collection&| |HomogeneousAggregate&| |OrderedSet&| 
|Aggregate&| |EltableAggregate&| |Evalable&| |SetCategory&| NIL NIL 
|InnerEvalable&| NIL NIL |BasicType&|)) (CONS (QUOTE !
#((|ListAggregate| 6) (|StreamAggregate| 6) (|ExtensibleLinearAggregate| 6) 
(|FiniteLinearAggregate| 6) (|UnaryRecursiveAggregate| 6) (|LinearAggregate| 6) 
(|RecursiveAggregate| 6) (|IndexedAggregate| 30 6) (|Collection| 6) 
(|HomogeneousAggregate| 6) (|OrderedSet|) (|Aggregate|) (|EltableAggregate| 30 
6) (|Evalable| 6) (|SetCategory|) (|Type|) (|Eltable| 30 6) (|InnerEvalable| 6 
6) (|CoercibleTo| 36) (|ConvertibleTo| 67) (|BasicType|))) (|makeByteWordVec2| 
70 (QUOTE (1 0 11 0 33 1 0 0 0 35 1 6 36 0 37 1 36 0 38 39 1 40 0 36 41 1 36 0 
38 42 1 36 0 0 43 2 40 0 0 36 44 1 0 36 0 45 2 6 11 0 0 46 2 0 11 0 0 47 1 6 48 
0 49 1 0 48 0 50 2 0 11 6 0 51 1 0 0 0 53 2 1 11 0 0 1 1 0 6 0 1 1 0 6 0 1 1 0 
0 0 1 3 0 62 0 30 30 1 2 0 0 0 30 57 1 3 11 0 1 2 0 11 54 0 1 1 3 0 0 1 2 0 0 
54 0 55 1 3 0 0 1 2 0 0 54 0 1 2 0 11 0 8 1 2 0 6 0 6 1 2 0 0 0 0 23 2 0 6 0 6 
1 2 0 6 0 6 21 3 0 6 0 30 6 1 3 0 6 0 63 6 1 3 0 6 0 64 6 1 3 0 0 0 19 0 24 3 0 
6 0 14 6 22 3 0 6 0 65 6 1 2 0 0 0 38 1 2 0 0 61 0 1 !
2 0 0 61 0 1 1 0 6 0 1 0 0 0 1 1 0 0 0 28 1 0 0 0 29 2 0 0 0 !
8 32 1 0 0 0 18 1 1 0 0 53 1 1 0 0 1 2 1 0 6 0 1 2 0 0 61 0 1 2 1 0 6 0 1 2 0 0 
61 0 1 4 1 6 58 0 6 6 1 2 0 6 58 0 1 3 0 6 58 0 6 1 3 0 6 0 30 6 1 2 0 6 0 30 1 
1 0 11 0 1 2 1 30 6 0 1 3 1 30 6 0 30 1 2 0 30 61 0 1 1 0 25 0 27 1 0 38 0 1 2 
1 11 0 0 1 2 0 0 8 6 1 2 0 11 0 8 1 1 5 30 0 31 2 3 0 0 0 1 2 3 0 0 0 1 3 0 0 
54 0 0 56 2 3 0 0 0 1 3 0 0 54 0 0 1 1 0 25 0 1 2 1 11 6 0 51 1 5 30 0 1 2 3 0 
0 0 1 2 0 0 66 0 1 3 0 0 58 0 0 1 2 0 0 66 0 1 1 0 0 6 1 2 0 11 0 8 1 1 0 25 0 
1 1 0 11 0 1 1 1 48 0 50 2 0 0 0 8 1 1 0 6 0 1 3 0 0 6 0 30 1 3 0 0 0 0 30 1 3 
0 0 0 0 30 1 3 0 0 6 0 30 1 1 0 69 0 1 2 0 11 30 0 1 1 1 68 0 1 2 0 0 0 8 1 1 0 
6 0 13 2 0 70 61 0 1 2 0 0 0 6 1 1 0 11 0 1 2 0 11 61 0 1 3 6 0 0 6 6 1 3 6 0 0 
25 25 1 2 6 0 0 59 1 2 6 0 0 60 1 2 0 11 0 0 12 2 1 11 6 0 1 1 0 25 0 1 1 0 11 
0 17 0 0 0 16 2 0 6 0 30 1 3 0 6 0 30 6 1 2 0 0 0 63 1 2 0 6 0 64 1 2 0 0 0 19 
20 2 0 6 0 14 15 2 0 6 0 65 1 2 0 30 0 0 1 2 0 0 0 63 1 2 0 0 0 30 1 2 0 0 0 63 
1 2 0 0 0 30 1 1 0 11 0 33 1 0 0 0 1 !
1 0 0 0 1 1 0 8 0 1 1 0 0 0 35 2 1 8 6 0 1 2 0 8 61 0 1 3 0 0 0 0 30 1 1 0 0 0 
34 1 2 67 0 1 1 0 0 25 26 2 0 0 0 0 52 2 0 0 0 6 1 1 0 0 38 1 2 0 0 0 6 1 2 0 0 
6 0 10 2 0 0 0 0 1 1 1 36 0 45 1 0 38 0 1 2 1 11 0 0 1 2 0 11 61 0 1 2 3 11 0 0 
1 2 3 11 0 0 1 2 1 11 0 0 47 2 3 11 0 0 1 2 3 11 0 0 1 1 0 8 0 9)))))) (QUOTE 
|lookupComplete|))) 
 @
 \section{domain LIST List}
+<<List.input>>=
+-- list.spad.pamphlet List.input
+)spool List.output
+)set message test on
+)set message auto off
+)clear all
+--S 1 of 34
+[2, 4, 5, 6]
+--R 
+--R
+--R   (1)  [2,4,5,6]
+--R                                                   Type: List 
PositiveInteger
+--E 1
+
+--S 2 of 34
+[1]
+--R 
+--R
+--R   (2)  [1]
+--R                                                   Type: List 
PositiveInteger
+--E 2
+
+--S 3 of 34
+list(1)
+--R 
+--R
+--R   (3)  [1]
+--R                                                   Type: List 
PositiveInteger
+--E 3
+
+--S 4 of 34
+append([1,2,3],[5,6,7])
+--R 
+--R
+--R   (4)  [1,2,3,5,6,7]
+--R                                                   Type: List 
PositiveInteger
+--E 4
+
+--S 5 of 34
+cons(10,[9,8,7])
+--R 
+--R
+--R   (5)  [10,9,8,7]
+--R                                                   Type: List 
PositiveInteger
+--E 5
+
+--S 6 of 34
+empty? [x+1]
+--R 
+--R
+--R   (6)  false
+--R                                                                Type: 
Boolean
+--E 6
+
+--S 7 of 34
+([] = nil)@Boolean
+--R 
+--R
+--R   (7)  true
+--R                                                                Type: 
Boolean
+--E 7
+
+--S 8 of 34
+k := [4,3,7,3,8,5,9,2]
+--R 
+--R
+--R   (8)  [4,3,7,3,8,5,9,2]
+--R                                                   Type: List 
PositiveInteger
+--E 8
+
+--S 9 of 34
+first k
+--R 
+--R
+--R   (9)  4
+--R                                                        Type: 
PositiveInteger
+--E 9
+
+--S 10 of 34
+k.first
+--R 
+--R
+--R   (10)  4
+--R                                                        Type: 
PositiveInteger
+--E 10
+
+--S 11 of 34
+k.1
+--R 
+--R
+--R   (11)  4
+--R                                                        Type: 
PositiveInteger
+--E 11
+
+--S 12 of 34
+k(1)
+--R 
+--R
+--R   (12)  4
+--R                                                        Type: 
PositiveInteger
+--E 12
+
+--S 13 of 34
+n := #k
+--R 
+--R
+--R   (13)  8
+--R                                                        Type: 
PositiveInteger
+--E 13
+
+--S 14 of 34
+last k
+--R 
+--R
+--R   (14)  2
+--R                                                        Type: 
PositiveInteger
+--E 14
+
+--S 15 of 34
+k.last
+--R 
+--R
+--R   (15)  2
+--R                                                        Type: 
PositiveInteger
+--E 15
+
+--S 16 of 34
+k.(#k)
+--R 
+--R
+--R   (16)  2
+--R                                                        Type: 
PositiveInteger
+--E 16
+
+--S 17 of 34
+k := [4,3,7,3,8,5,9,2]
+--R 
+--R
+--R   (17)  [4,3,7,3,8,5,9,2]
+--R                                                   Type: List 
PositiveInteger
+--E 17
+
+--S 18 of 34
+k.1 := 999
+--R 
+--R
+--R   (18)  999
+--R                                                        Type: 
PositiveInteger
+--E 18
+
+--S 19 of 34
+k
+--R 
+--R
+--R   (19)  [999,3,7,3,8,5,9,2]
+--R                                                   Type: List 
PositiveInteger
+--E 19
+
+--S 20 of 34
+k := [1,2]
+--R 
+--R
+--R   (20)  [1,2]
+--R                                                   Type: List 
PositiveInteger
+--E 20
+
+--S 21 of 34
+m := cons(0,k)
+--R 
+--R
+--R   (21)  [0,1,2]
+--R                                                           Type: List 
Integer
+--E 21
+
+--S 22 of 34
+m.2 := 99 
+--R 
+--R
+--R   (22)  99
+--R                                                        Type: 
PositiveInteger
+--E 22
+
+--S 23 of 34
+m 
+--R 
+--R
+--R   (23)  [0,99,2]
+--R                                                           Type: List 
Integer
+--E 23
+
+--S 24 of 34
+k
+--R 
+--R
+--R   (24)  [99,2]
+--R                                                   Type: List 
PositiveInteger
+--E 24
+
+--S 25 of 34
+k := [1,2,3]
+--R 
+--R
+--R   (25)  [1,2,3]
+--R                                                   Type: List 
PositiveInteger
+--E 25
+
+--S 26 of 34
+rest k
+--R 
+--R
+--R   (26)  [2,3]
+--R                                                   Type: List 
PositiveInteger
+--E 26
+
+--S 27 of 34
+removeDuplicates [4,3,4,3,5,3,4]
+--R 
+--R
+--R   (27)  [4,3,5]
+--R                                                   Type: List 
PositiveInteger
+--E 27
+
+--S 28 of 34
+reverse [1,2,3,4,5,6]
+--R 
+--R
+--R   (28)  [6,5,4,3,2,1]
+--R                                                   Type: List 
PositiveInteger
+--E 28
+
+--S 29 of 34
+member?(1/2,[3/4,5/6,1/2])
+--R 
+--R
+--R   (29)  true
+--R                                                                Type: 
Boolean
+--E 29
+
+--S 30 of 34
+member?(1/12,[3/4,5/6,1/2])
+--R 
+--R
+--R   (30)  false
+--R                                                                Type: 
Boolean
+--E 30
+
+--S 31 of 34
+reverse(rest(reverse(k)))
+--R 
+--R
+--R   (31)  [1,2]
+--R                                                   Type: List 
PositiveInteger
+--E 31
+
+--S 32 of 34
+[1..3,10,20..23]
+--R 
+--R
+--R   (32)  [1..3,10..10,20..23]
+--R                                           Type: List Segment 
PositiveInteger
+--E 32
+
+--S 33 of 34
+expand [1..3,10,20..23]
+--R 
+--R
+--R   (33)  [1,2,3,10,20,21,22,23]
+--R                                                           Type: List 
Integer
+--E 33
+
+--S 34 of 34
+expand [1..]
+--R 
+--R
+--R   (34)  [1,2,3,4,5,6,7,8,9,10,...]
+--R                                                         Type: Stream 
Integer
+--E 34
+)spool
+)lisp (bye)
+@
+<<List.help>>=
+====================================================================
+List examples
+====================================================================
+
+A list is a finite collection of elements in a specified order that
+can contain duplicates.  A list is a convenient structure to work with
+because it is easy to add or remove elements and the length need not
+be constant.  There are many different kinds of lists in Axiom, but
+the default types (and those used most often) are created by the List
+constructor.  For example, there are objects of type List Integer,
+List Float and List Polynomial Fraction Integer.  Indeed, you can even
+have List List List Boolean (that is, lists of lists of lists of
+Boolean values).  You can have lists of any type of Axiom object.
+
+====================================================================
+Creating Lists
+====================================================================
+
+The easiest way to create a list with, for example, the elements 
+2, 4, 5, 6 is to enclose the elements with square brackets and 
+separate the elements with commas.
+
+The spaces after the commas are optional, but they do improve the
+readability.
+
+  [2, 4, 5, 6]
+    [2,4,5,6]
+                          Type: List PositiveInteger
+
+To create a list with the single element 1, you can use either [1] or
+the operation list.
+
+  [1]
+    [1]
+                          Type: List PositiveInteger
+
+  list(1)
+    [1]
+                          Type: List PositiveInteger
+
+Once created, two lists k and m can be concatenated by issuing
+append(k,m).  append does not physically join the lists, but rather
+produces a new list with the elements coming from the two arguments.
+
+  append([1,2,3],[5,6,7])
+    [1,2,3,5,6,7]
+                           Type: List PositiveInteger
+
+Use cons to append an element onto the front of a list.
+
+  cons(10,[9,8,7])
+    [10,9,8,7]
+                           Type: List PositiveInteger
+
+====================================================================
+Accessing List Elements
+====================================================================
+
+To determine whether a list has any elements, use the operation empty?.
+
+  empty? [x+1]
+    false
+                           Type: Boolean
+
+Alternatively, equality with the list constant nil can be tested.
+
+  ([] = nil)@Boolean
+    true
+                           Type: Boolean
+
+We'll use this in some of the following examples.
+
+  k := [4,3,7,3,8,5,9,2]
+    [4,3,7,3,8,5,9,2]
+                           Type: List PositiveInteger
+
+Each of the next four expressions extracts the first element of k.
+
+  first k
+    4
+                           Type: PositiveInteger
+
+  k.first
+    4
+                           Type: PositiveInteger
+
+  k.1
+    4
+                           Type: PositiveInteger
+
+  k(1)
+    4
+                           Type: PositiveInteger
+
+The last two forms generalize to k.i and k(i), respectively, where 
+1 <= i <= n and n equals the length of k.
+
+This length is calculated by #.
+
+  n := #k
+    8
+                           Type: PositiveInteger
+
+Performing an operation such as k.i is sometimes referred to as
+indexing into k or elting into k.  The latter phrase comes about
+because the name of the operation that extracts elements is called
+elt.  That is, k.3 is just alternative syntax for elt(k,3).  It is
+important to remember that list indices begin with 1.  If we issue 
+k := [1,3,2,9,5] then k.4 returns 9.  It is an error to use an index
+that is not in the range from 1 to the length of the list.
+
+The last element of a list is extracted by any of the following three
+expressions.
+
+  last k
+    2
+                              Type: PositiveInteger
+
+  k.last
+    2
+                              Type: PositiveInteger
+
+This form computes the index of the last element and then extracts the
+element from the list.
+
+  k.(#k)
+    2
+                              Type: PositiveInteger
+
+====================================================================
+Changing List Elements
+====================================================================
+
+We'll use this in some of the following examples.
+
+  k := [4,3,7,3,8,5,9,2]
+    [4,3,7,3,8,5,9,2]
+                              Type: List PositiveInteger
+
+List elements are reset by using the k.i form on the left-hand side of 
+an assignment.  This expression resets the first element of k to 999.
+
+  k.1 := 999
+    999
+                              Type: PositiveInteger
+
+As with indexing into a list, it is an error to use an index that is
+not within the proper bounds.  Here you see that k was modified.
+
+  k
+    [999,3,7,3,8,5,9,2]
+                              Type: List PositiveInteger
+
+The operation that performs the assignment of an element to a
+particular position in a list is called setelt.  This operation is
+destructive in that it changes the list.  In the above example, the
+assignment returned the value 999 and k was modified.  For this
+reason, lists are called mutable objects: it is possible to change
+part of a list (mutate it) rather than always returning a new list
+reflecting the intended modifications.
+
+Moreover, since lists can share structure, changes to one list can
+sometimes affect others.
+
+  k := [1,2]
+    [1,2]
+                               Type: List PositiveInteger
+
+  m := cons(0,k)
+    [0,1,2]
+                               Type: List Integer
+
+Change the second element of m.
+
+  m.2 := 99 
+    99
+                               Type: PositiveInteger
+
+See, m was altered.
+
+  m 
+    [0,99,2]
+                               Type: List Integer
+
+But what about k?  It changed too!
+
+  k
+    [99,2]
+                               Type: List PositiveInteger
+
+====================================================================
+Other Functions
+====================================================================
+
+An operation that is used frequently in list processing is that
+which returns all elements in a list after the first element.
+
+  k := [1,2,3]
+    [1,2,3]
+                              Type: List PositiveInteger
+
+Use the rest operation to do this.
+
+  rest k
+    [2,3]
+                              Type: List PositiveInteger
+
+To remove duplicate elements in a list k, use removeDuplicates.
+
+  removeDuplicates [4,3,4,3,5,3,4]
+    [4,3,5]
+                              Type: List PositiveInteger
+
+To get a list with elements in the order opposite to those in a list
+k, use reverse.
+
+  reverse [1,2,3,4,5,6]
+    [6,5,4,3,2,1]
+                              Type: List PositiveInteger
+
+To test whether an element is in a list, use member?: member?(a,k)
+returns true or false depending on whether a is in k or not.
+
+  member?(1/2,[3/4,5/6,1/2])
+    true
+                              Type: Boolean
+
+  member?(1/12,[3/4,5/6,1/2])
+    false
+                              Type: Boolean
+
+We can get a list containing all but the last of the elements in a
+given non-empty list k.
+
+  reverse(rest(reverse(k)))
+    [1,2]
+                              Type: List PositiveInteger
+
+====================================================================
+Dot, Dot
+====================================================================
+
+Certain lists are used so often that Axiom provides an easy way of
+constructing them.  If n and m are integers, then expand [n..m]
+creates a list containing n, n+1, ... m.  If n > m then the list is
+empty.  It is actually permissible to leave off the m in the dot-dot
+construction (see below).
+
+The dot-dot notation can be used more than once in a list construction
+and with specific elements being given.  Items separated by dots are
+called segments.
+
+  [1..3,10,20..23]
+    [1..3,10..10,20..23]
+                             Type: List Segment PositiveInteger
+
+Segments can be expanded into the range of items between the endpoints
+by using expand.
+
+  expand [1..3,10,20..23]
+    [1,2,3,10,20,21,22,23]
+                             Type: List Integer
+
+What happens if we leave off a number on the right-hand side of ..?
+
+  expand [1..]
+    [1,2,3,4,5,6,7,8,9,10,...]
+                             Type: Stream Integer
+
+What is created in this case is a Stream which is a generalization of
+a list.
+
+See Also:
+o )help Stream
+o )show List
+o $AXIOM/doc/src/algebra/list.spad.dvi
+
+@
 <<domain LIST List>>=
 )abbrev domain LIST List
 ++ Author: Michael Monagan
diff --git a/src/algebra/mappkg.spad.pamphlet b/src/algebra/mappkg.spad.pamphlet
index f4d18db..5ec4358 100644
--- a/src/algebra/mappkg.spad.pamphlet
+++ b/src/algebra/mappkg.spad.pamphlet
@@ -77,6 +77,421 @@ MappingPackageInternalHacks3(A: SetCategory, B: 
SetCategory, C: SetCategory):_
 
 @
 \section{package MAPPKG1 MappingPackage1}
+<<MappingPackage1.input>>=
+-- mappkg.spad.pamphlet MappingPackage1.input
+)spool MappingPackage1.output
+)set message test on
+)set message auto off
+)clear all
+--S 1
+power(q: FRAC INT, n: INT): FRAC INT == q**n
+--R 
+--R   Function declaration power : (Fraction Integer,Integer) -> Fraction 
+--R      Integer has been added to workspace.
+--R                                                                   Type: 
Void
+--E 1
+
+--S 2
+power(2,3)
+--R 
+--R   Compiling function power with type (Fraction Integer,Integer) -> 
+--R      Fraction Integer 
+--R
+--R   (2)  8
+--R                                                       Type: Fraction 
Integer
+--E 2
+
+--S 3
+rewop := twist power
+--R 
+--R
+--R   (3)  theMap(MAPPKG3;twist;MM;5!0)
+--R                       Type: ((Integer,Fraction Integer) -> Fraction 
Integer)
+--E 3
+
+--S 4
+rewop(3, 2)
+--R 
+--R
+--R   (4)  8
+--R                                                       Type: Fraction 
Integer
+--E 4
+
+--S 5
+square: FRAC INT -> FRAC INT
+--R 
+--R                                                                   Type: 
Void
+--E 5
+
+--S 6
+square:= curryRight(power, 2)
+--R 
+--R
+--R   (6)  theMap(MAPPKG3;curryRight;MBM;1!0,0)
+--R                                 Type: (Fraction Integer -> Fraction 
Integer)
+--E 6
+
+--S 7
+square 4
+--R 
+--R
+--R   (7)  16
+--R                                                       Type: Fraction 
Integer
+--E 7
+
+--S 8
+squirrel:= constantRight(square)$MAPPKG3(FRAC INT,FRAC INT,FRAC INT)
+--R 
+--R
+--R   (8)  theMap(MAPPKG3;constantRight;MM;3!0)
+--R              Type: ((Fraction Integer,Fraction Integer) -> Fraction 
Integer)
+--E 8
+
+--S 9
+squirrel(1/2, 1/3)
+--R 
+--R
+--R        1
+--R   (9)  -
+--R        4
+--R                                                       Type: Fraction 
Integer
+--E 9
+
+--S 10
+sixteen := curry(square, 4/1)
+--R 
+--R
+--R   (10)  theMap(MAPPKG2;curry;MAM;2!0,0)
+--R                                               Type: (() -> Fraction 
Integer)
+--E 10
+
+--S 11
+sixteen()
+--R 
+--R
+--R   (11)  16
+--R                                                       Type: Fraction 
Integer
+--E 11
+
+--S 12
+square2:=square*square
+--R 
+--R
+--R   (12)  theMap(MAPPKG3;*;MMM;6!0,0)
+--R                                 Type: (Fraction Integer -> Fraction 
Integer)
+--E 12
+
+--S 13
+square2 3
+--R 
+--R
+--R   (13)  81
+--R                                                       Type: Fraction 
Integer
+--E 13
+
+--S 14
+sc(x: FRAC INT): FRAC INT == x + 1
+--R 
+--R   Function declaration sc : Fraction Integer -> Fraction Integer has 
+--R      been added to workspace.
+--R                                                                   Type: 
Void
+--E 14
+
+--S 15
+incfns := [sc**i for i in 0..10]
+--R 
+--R   Compiling function sc with type Fraction Integer -> Fraction Integer
+--R      
+--R
+--R   (15)
+--R   [theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0),
+--R    theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0),
+--R    theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0),
+--R    theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0),
+--R    theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0),
+--R    theMap(MAPPKG1;**;MNniM;6!0,0)]
+--R                            Type: List (Fraction Integer -> Fraction 
Integer)
+--E 15
+
+--S 16
+[f 4 for f in incfns]
+--R 
+--R
+--R   (16)  [4,5,6,7,8,9,10,11,12,13,14]
+--R                                                  Type: List Fraction 
Integer
+--E 16
+
+--S 17
+times(n:NNI, i:INT):INT == n*i
+--R 
+--R   Function declaration times : (NonNegativeInteger,Integer) -> Integer
+--R      has been added to workspace.
+--R                                                                   Type: 
Void
+--E 17
+
+--S 18
+r := recur(times)
+--R 
+--R   Compiling function times with type (NonNegativeInteger,Integer) -> 
+--R      Integer 
+--R
+--R   (18)  theMap(MAPPKG1;recur;2M;7!0,0)
+--R                              Type: ((NonNegativeInteger,Integer) -> 
Integer)
+--E 18
+
+--S 19
+fact := curryRight(r, 1)
+--R 
+--R
+--R   (19)  theMap(MAPPKG3;curryRight;MBM;1!0,0)
+--R                                        Type: (NonNegativeInteger -> 
Integer)
+--E 19
+
+--S 20
+fact 4
+--R 
+--R
+--R   (20)  24
+--R                                                        Type: 
PositiveInteger
+--E 20
+
+--S 21
+mto2ton(m, n) ==
+  raiser := square^n
+  raiser m
+--R 
+--R                                                                   Type: 
Void
+--E 21
+
+--S 22
+mto2ton(3, 3)
+--R 
+--R   Compiling function mto2ton with type (PositiveInteger,
+--R      PositiveInteger) -> Fraction Integer 
+--R
+--R   (22)  6561
+--R                                                       Type: Fraction 
Integer
+--E 22
+
+--S 23
+shiftfib(r: List INT) : INT ==
+  t := r.1
+  r.1 := r.2
+  r.2 := r.2 + t
+  t
+--R 
+--R   Function declaration shiftfib : List Integer -> Integer has been 
+--R      added to workspace.
+--R                                                                   Type: 
Void
+--E 23
+
+--S 24
+fibinit: List INT := [0, 1]
+--R 
+--R
+--R   (24)  [0,1]
+--R                                                           Type: List 
Integer
+--E 24
+
+--S 25
+fibs := curry(shiftfib, fibinit)
+--R 
+--R   Compiling function shiftfib with type List Integer -> Integer 
+--R
+--R   (25)  theMap(MAPPKG2;curry;MAM;2!0,0)
+--R                                                        Type: (() -> 
Integer)
+--E 25
+
+--S 26
+[fibs() for i in 0..30]
+--R 
+--R
+--R   (26)
+--R   [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597,
+--R    2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418,
+--R    317811, 514229, 832040]
+--R                                                           Type: List 
Integer
+--E 26
+)spool
+)lisp (bye)
+@
+<<MappingPackage1.help>>=
+====================================================================
+MappingPackage examples
+====================================================================
+
+Function are objects of type Mapping.  In this section we demonstrate
+some library operations from the packages MappingPackage1, MappingPackage2, 
+and MappingPackage3 that manipulate and create functions. Some terminology: 
+a nullary function takes no arguments, a unary function takes one argument, 
+and a binary function takes two arguments.
+
+We begin by creating an example function that raises a rational number
+to an integer exponent.
+
+  power(q: FRAC INT, n: INT): FRAC INT == q**n
+                      Type: Void
+
+  power(2,3)
+    8
+                       Type: Fraction Integer
+
+The twist operation transposes the arguments of a binary function.
+Here rewop(a, b) is power(b, a).
+
+  rewop := twist power
+    theMap(MAPPKG3;twist;MM;5!0)
+                       Type: ((Integer,Fraction Integer) -> Fraction Integer)
+
+This is 2^3.
+
+  rewop(3, 2)
+    8
+                       Type: Fraction Integer
+
+Now we define square in terms of power.
+
+  square: FRAC INT -> FRAC INT
+                       Type: Void
+The curryRight operation creates a unary function from a binary one by
+providing a constant argument on the right.
+
+  square:= curryRight(power, 2)
+    theMap(MAPPKG3;curryRight;MBM;1!0,0)
+                       Type: (Fraction Integer -> Fraction Integer)
+
+Likewise, the curryLeft operation provides a constant argument on the
+left.
+
+  square 4
+    16
+                       Type: Fraction Integer
+
+The constantRight operation creates (in a trivial way) a binary
+function from a unary one: constantRight(f) is the function g such
+that g(a,b)= f(a).
+
+  squirrel:= constantRight(square)$MAPPKG3(FRAC INT,FRAC INT,FRAC INT)
+    theMap(MAPPKG3;constantRight;MM;3!0)
+              Type: ((Fraction Integer,Fraction Integer) -> Fraction Integer)
+
+Likewise, constantLeft(f) is the function g such that g(a,b)= f(b).
+
+  squirrel(1/2, 1/3)
+    1
+    -
+    4
+                       Type: Fraction Integer
+
+The curry operation makes a unary function nullary.
+
+  sixteen := curry(square, 4/1)
+    theMap(MAPPKG2;curry;MAM;2!0,0)
+                       Type: (() -> Fraction Integer)
+
+  sixteen()
+    16
+                       Type: Fraction Integer
+
+The * operation constructs composed functions.
+
+  square2:=square*square
+    theMap(MAPPKG3;*;MMM;6!0,0)
+                       Type: (Fraction Integer -> Fraction Integer)
+
+  square2 3
+    81
+                       Type: Fraction Integer
+
+Use the ** operation to create functions that are n-fold iterations of
+other functions.
+
+  sc(x: FRAC INT): FRAC INT == x + 1
+                       Type: Void
+
+This is a list of Mapping objects.
+
+  incfns := [sc**i for i in 0..10]
+   [theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0),
+    theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0),
+    theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0),
+    theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0),
+    theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0),
+    theMap(MAPPKG1;**;MNniM;6!0,0)]
+                       Type: List (Fraction Integer -> Fraction Integer)
+
+This is a list of applications of those functions.
+
+  [f 4 for f in incfns]
+    [4,5,6,7,8,9,10,11,12,13,14]
+                       Type: List Fraction Integer
+
+Use the recur operation for recursion:
+
+  g := recur f means g(n,x) == f(n,f(n-1,...f(1,x))).
+
+  times(n:NNI, i:INT):INT == n*i
+                       Type: Void
+
+  r := recur(times)
+    theMap(MAPPKG1;recur;2M;7!0,0)
+                       Type: ((NonNegativeInteger,Integer) -> Integer)
+
+This is a factorial function.
+
+  fact := curryRight(r, 1)
+    theMap(MAPPKG3;curryRight;MBM;1!0,0)
+                       Type: (NonNegativeInteger -> Integer)
+
+  fact 4
+    24
+                       Type: PositiveInteger
+
+Constructed functions can be used within other functions.
+
+  mto2ton(m, n) ==
+    raiser := square^n
+    raiser m
+                       Type: Void
+
+This is 3^(2^3).
+
+  mto2ton(3, 3)
+    6561
+                       Type: Fraction Integer
+
+Here shiftfib is a unary function that modifies its argument.
+
+  shiftfib(r: List INT) : INT ==
+    t := r.1
+    r.1 := r.2
+    r.2 := r.2 + t
+    t
+                       Type: Void
+
+By currying over the argument we get a function with private state.
+
+  fibinit: List INT := [0, 1]
+    [0,1]
+                       Type: List Integer
+
+  fibs := curry(shiftfib, fibinit)
+    theMap(MAPPKG2;curry;MAM;2!0,0)
+                       Type: (() -> Integer)
+
+  [fibs() for i in 0..30]
+   [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597,
+    2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418,
+    317811, 514229, 832040]
+                       Type: List Integer
+
+See Also:
+o )help MappingPackage2
+o )help MappingPackage3
+o )show MappingPackage1
+o $AXIOM/doc/src/algebra/mappkg.spad.dvi
+
+@
 <<package MAPPKG1 MappingPackage1>>=
 )abbrev package MAPPKG1 MappingPackage1
 ++ Author: S.M.Watt and W.H.Burge
@@ -152,6 +567,421 @@ MappingPackage1(A:SetCategory): MPcat == MPdef where
 
 @
 \section{package MAPPKG2 MappingPackage2}
+<<MappingPackage2.input>>=
+-- mappkg.spad.pamphlet MappingPackage2.input
+)spool MappingPackage2.output
+)set message test on
+)set message auto off
+)clear all
+--S 1
+power(q: FRAC INT, n: INT): FRAC INT == q**n
+--R 
+--R   Function declaration power : (Fraction Integer,Integer) -> Fraction 
+--R      Integer has been added to workspace.
+--R                                                                   Type: 
Void
+--E 1
+
+--S 2
+power(2,3)
+--R 
+--R   Compiling function power with type (Fraction Integer,Integer) -> 
+--R      Fraction Integer 
+--R
+--R   (2)  8
+--R                                                       Type: Fraction 
Integer
+--E 2
+
+--S 3
+rewop := twist power
+--R 
+--R
+--R   (3)  theMap(MAPPKG3;twist;MM;5!0)
+--R                       Type: ((Integer,Fraction Integer) -> Fraction 
Integer)
+--E 3
+
+--S 4
+rewop(3, 2)
+--R 
+--R
+--R   (4)  8
+--R                                                       Type: Fraction 
Integer
+--E 4
+
+--S 5
+square: FRAC INT -> FRAC INT
+--R 
+--R                                                                   Type: 
Void
+--E 5
+
+--S 6
+square:= curryRight(power, 2)
+--R 
+--R
+--R   (6)  theMap(MAPPKG3;curryRight;MBM;1!0,0)
+--R                                 Type: (Fraction Integer -> Fraction 
Integer)
+--E 6
+
+--S 7
+square 4
+--R 
+--R
+--R   (7)  16
+--R                                                       Type: Fraction 
Integer
+--E 7
+
+--S 8
+squirrel:= constantRight(square)$MAPPKG3(FRAC INT,FRAC INT,FRAC INT)
+--R 
+--R
+--R   (8)  theMap(MAPPKG3;constantRight;MM;3!0)
+--R              Type: ((Fraction Integer,Fraction Integer) -> Fraction 
Integer)
+--E 8
+
+--S 9
+squirrel(1/2, 1/3)
+--R 
+--R
+--R        1
+--R   (9)  -
+--R        4
+--R                                                       Type: Fraction 
Integer
+--E 9
+
+--S 10
+sixteen := curry(square, 4/1)
+--R 
+--R
+--R   (10)  theMap(MAPPKG2;curry;MAM;2!0,0)
+--R                                               Type: (() -> Fraction 
Integer)
+--E 10
+
+--S 11
+sixteen()
+--R 
+--R
+--R   (11)  16
+--R                                                       Type: Fraction 
Integer
+--E 11
+
+--S 12
+square2:=square*square
+--R 
+--R
+--R   (12)  theMap(MAPPKG3;*;MMM;6!0,0)
+--R                                 Type: (Fraction Integer -> Fraction 
Integer)
+--E 12
+
+--S 13
+square2 3
+--R 
+--R
+--R   (13)  81
+--R                                                       Type: Fraction 
Integer
+--E 13
+
+--S 14
+sc(x: FRAC INT): FRAC INT == x + 1
+--R 
+--R   Function declaration sc : Fraction Integer -> Fraction Integer has 
+--R      been added to workspace.
+--R                                                                   Type: 
Void
+--E 14
+
+--S 15
+incfns := [sc**i for i in 0..10]
+--R 
+--R   Compiling function sc with type Fraction Integer -> Fraction Integer
+--R      
+--R
+--R   (15)
+--R   [theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0),
+--R    theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0),
+--R    theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0),
+--R    theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0),
+--R    theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0),
+--R    theMap(MAPPKG1;**;MNniM;6!0,0)]
+--R                            Type: List (Fraction Integer -> Fraction 
Integer)
+--E 15
+
+--S 16
+[f 4 for f in incfns]
+--R 
+--R
+--R   (16)  [4,5,6,7,8,9,10,11,12,13,14]
+--R                                                  Type: List Fraction 
Integer
+--E 16
+
+--S 17
+times(n:NNI, i:INT):INT == n*i
+--R 
+--R   Function declaration times : (NonNegativeInteger,Integer) -> Integer
+--R      has been added to workspace.
+--R                                                                   Type: 
Void
+--E 17
+
+--S 18
+r := recur(times)
+--R 
+--R   Compiling function times with type (NonNegativeInteger,Integer) -> 
+--R      Integer 
+--R
+--R   (18)  theMap(MAPPKG1;recur;2M;7!0,0)
+--R                              Type: ((NonNegativeInteger,Integer) -> 
Integer)
+--E 18
+
+--S 19
+fact := curryRight(r, 1)
+--R 
+--R
+--R   (19)  theMap(MAPPKG3;curryRight;MBM;1!0,0)
+--R                                        Type: (NonNegativeInteger -> 
Integer)
+--E 19
+
+--S 20
+fact 4
+--R 
+--R
+--R   (20)  24
+--R                                                        Type: 
PositiveInteger
+--E 20
+
+--S 21
+mto2ton(m, n) ==
+  raiser := square^n
+  raiser m
+--R 
+--R                                                                   Type: 
Void
+--E 21
+
+--S 22
+mto2ton(3, 3)
+--R 
+--R   Compiling function mto2ton with type (PositiveInteger,
+--R      PositiveInteger) -> Fraction Integer 
+--R
+--R   (22)  6561
+--R                                                       Type: Fraction 
Integer
+--E 22
+
+--S 23
+shiftfib(r: List INT) : INT ==
+  t := r.1
+  r.1 := r.2
+  r.2 := r.2 + t
+  t
+--R 
+--R   Function declaration shiftfib : List Integer -> Integer has been 
+--R      added to workspace.
+--R                                                                   Type: 
Void
+--E 23
+
+--S 24
+fibinit: List INT := [0, 1]
+--R 
+--R
+--R   (24)  [0,1]
+--R                                                           Type: List 
Integer
+--E 24
+
+--S 25
+fibs := curry(shiftfib, fibinit)
+--R 
+--R   Compiling function shiftfib with type List Integer -> Integer 
+--R
+--R   (25)  theMap(MAPPKG2;curry;MAM;2!0,0)
+--R                                                        Type: (() -> 
Integer)
+--E 25
+
+--S 26
+[fibs() for i in 0..30]
+--R 
+--R
+--R   (26)
+--R   [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597,
+--R    2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418,
+--R    317811, 514229, 832040]
+--R                                                           Type: List 
Integer
+--E 26
+)spool
+)lisp (bye)
+@
+<<MappingPackage2.help>>=
+====================================================================
+MappingPackage examples
+====================================================================
+
+Function are objects of type Mapping.  In this section we demonstrate
+some library operations from the packages MappingPackage1, MappingPackage2, 
+and MappingPackage3 that manipulate and create functions. Some terminology: 
+a nullary function takes no arguments, a unary function takes one argument, 
+and a binary function takes two arguments.
+
+We begin by creating an example function that raises a rational number
+to an integer exponent.
+
+  power(q: FRAC INT, n: INT): FRAC INT == q**n
+                      Type: Void
+
+  power(2,3)
+    8
+                       Type: Fraction Integer
+
+The twist operation transposes the arguments of a binary function.
+Here rewop(a, b) is power(b, a).
+
+  rewop := twist power
+    theMap(MAPPKG3;twist;MM;5!0)
+                       Type: ((Integer,Fraction Integer) -> Fraction Integer)
+
+This is 2^3.
+
+  rewop(3, 2)
+    8
+                       Type: Fraction Integer
+
+Now we define square in terms of power.
+
+  square: FRAC INT -> FRAC INT
+                       Type: Void
+The curryRight operation creates a unary function from a binary one by
+providing a constant argument on the right.
+
+  square:= curryRight(power, 2)
+    theMap(MAPPKG3;curryRight;MBM;1!0,0)
+                       Type: (Fraction Integer -> Fraction Integer)
+
+Likewise, the curryLeft operation provides a constant argument on the
+left.
+
+  square 4
+    16
+                       Type: Fraction Integer
+
+The constantRight operation creates (in a trivial way) a binary
+function from a unary one: constantRight(f) is the function g such
+that g(a,b)= f(a).
+
+  squirrel:= constantRight(square)$MAPPKG3(FRAC INT,FRAC INT,FRAC INT)
+    theMap(MAPPKG3;constantRight;MM;3!0)
+              Type: ((Fraction Integer,Fraction Integer) -> Fraction Integer)
+
+Likewise, constantLeft(f) is the function g such that g(a,b)= f(b).
+
+  squirrel(1/2, 1/3)
+    1
+    -
+    4
+                       Type: Fraction Integer
+
+The curry operation makes a unary function nullary.
+
+  sixteen := curry(square, 4/1)
+    theMap(MAPPKG2;curry;MAM;2!0,0)
+                       Type: (() -> Fraction Integer)
+
+  sixteen()
+    16
+                       Type: Fraction Integer
+
+The * operation constructs composed functions.
+
+  square2:=square*square
+    theMap(MAPPKG3;*;MMM;6!0,0)
+                       Type: (Fraction Integer -> Fraction Integer)
+
+  square2 3
+    81
+                       Type: Fraction Integer
+
+Use the ** operation to create functions that are n-fold iterations of
+other functions.
+
+  sc(x: FRAC INT): FRAC INT == x + 1
+                       Type: Void
+
+This is a list of Mapping objects.
+
+  incfns := [sc**i for i in 0..10]
+   [theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0),
+    theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0),
+    theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0),
+    theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0),
+    theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0),
+    theMap(MAPPKG1;**;MNniM;6!0,0)]
+                       Type: List (Fraction Integer -> Fraction Integer)
+
+This is a list of applications of those functions.
+
+  [f 4 for f in incfns]
+    [4,5,6,7,8,9,10,11,12,13,14]
+                       Type: List Fraction Integer
+
+Use the recur operation for recursion:
+
+  g := recur f means g(n,x) == f(n,f(n-1,...f(1,x))).
+
+  times(n:NNI, i:INT):INT == n*i
+                       Type: Void
+
+  r := recur(times)
+    theMap(MAPPKG1;recur;2M;7!0,0)
+                       Type: ((NonNegativeInteger,Integer) -> Integer)
+
+This is a factorial function.
+
+  fact := curryRight(r, 1)
+    theMap(MAPPKG3;curryRight;MBM;1!0,0)
+                       Type: (NonNegativeInteger -> Integer)
+
+  fact 4
+    24
+                       Type: PositiveInteger
+
+Constructed functions can be used within other functions.
+
+  mto2ton(m, n) ==
+    raiser := square^n
+    raiser m
+                       Type: Void
+
+This is 3^(2^3).
+
+  mto2ton(3, 3)
+    6561
+                       Type: Fraction Integer
+
+Here shiftfib is a unary function that modifies its argument.
+
+  shiftfib(r: List INT) : INT ==
+    t := r.1
+    r.1 := r.2
+    r.2 := r.2 + t
+    t
+                       Type: Void
+
+By currying over the argument we get a function with private state.
+
+  fibinit: List INT := [0, 1]
+    [0,1]
+                       Type: List Integer
+
+  fibs := curry(shiftfib, fibinit)
+    theMap(MAPPKG2;curry;MAM;2!0,0)
+                       Type: (() -> Integer)
+
+  [fibs() for i in 0..30]
+   [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597,
+    2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418,
+    317811, 514229, 832040]
+                       Type: List Integer
+
+See Also:
+o )help MappingPackage1
+o )help MappingPackage3
+o )show MappingPackage2
+o $AXIOM/doc/src/algebra/mappkg.spad.dvi
+
+@
 <<package MAPPKG2 MappingPackage2>>=
 )abbrev package MAPPKG2 MappingPackage2
 ++ Description: various Currying operations.
@@ -194,6 +1024,421 @@ MappingPackage2(A:SetCategory, C:SetCategory): MPcat == 
MPdef where
 
 @
 \section{package MAPPKG3 MappingPackage3}
+<<MappingPackage3.input>>=
+-- mappkg.spad.pamphlet MappingPackage3.input
+)spool MappingPackage3.output
+)set message test on
+)set message auto off
+)clear all
+--S 1
+power(q: FRAC INT, n: INT): FRAC INT == q**n
+--R 
+--R   Function declaration power : (Fraction Integer,Integer) -> Fraction 
+--R      Integer has been added to workspace.
+--R                                                                   Type: 
Void
+--E 1
+
+--S 2
+power(2,3)
+--R 
+--R   Compiling function power with type (Fraction Integer,Integer) -> 
+--R      Fraction Integer 
+--R
+--R   (2)  8
+--R                                                       Type: Fraction 
Integer
+--E 2
+
+--S 3
+rewop := twist power
+--R 
+--R
+--R   (3)  theMap(MAPPKG3;twist;MM;5!0)
+--R                       Type: ((Integer,Fraction Integer) -> Fraction 
Integer)
+--E 3
+
+--S 4
+rewop(3, 2)
+--R 
+--R
+--R   (4)  8
+--R                                                       Type: Fraction 
Integer
+--E 4
+
+--S 5
+square: FRAC INT -> FRAC INT
+--R 
+--R                                                                   Type: 
Void
+--E 5
+
+--S 6
+square:= curryRight(power, 2)
+--R 
+--R
+--R   (6)  theMap(MAPPKG3;curryRight;MBM;1!0,0)
+--R                                 Type: (Fraction Integer -> Fraction 
Integer)
+--E 6
+
+--S 7
+square 4
+--R 
+--R
+--R   (7)  16
+--R                                                       Type: Fraction 
Integer
+--E 7
+
+--S 8
+squirrel:= constantRight(square)$MAPPKG3(FRAC INT,FRAC INT,FRAC INT)
+--R 
+--R
+--R   (8)  theMap(MAPPKG3;constantRight;MM;3!0)
+--R              Type: ((Fraction Integer,Fraction Integer) -> Fraction 
Integer)
+--E 8
+
+--S 9
+squirrel(1/2, 1/3)
+--R 
+--R
+--R        1
+--R   (9)  -
+--R        4
+--R                                                       Type: Fraction 
Integer
+--E 9
+
+--S 10
+sixteen := curry(square, 4/1)
+--R 
+--R
+--R   (10)  theMap(MAPPKG2;curry;MAM;2!0,0)
+--R                                               Type: (() -> Fraction 
Integer)
+--E 10
+
+--S 11
+sixteen()
+--R 
+--R
+--R   (11)  16
+--R                                                       Type: Fraction 
Integer
+--E 11
+
+--S 12
+square2:=square*square
+--R 
+--R
+--R   (12)  theMap(MAPPKG3;*;MMM;6!0,0)
+--R                                 Type: (Fraction Integer -> Fraction 
Integer)
+--E 12
+
+--S 13
+square2 3
+--R 
+--R
+--R   (13)  81
+--R                                                       Type: Fraction 
Integer
+--E 13
+
+--S 14
+sc(x: FRAC INT): FRAC INT == x + 1
+--R 
+--R   Function declaration sc : Fraction Integer -> Fraction Integer has 
+--R      been added to workspace.
+--R                                                                   Type: 
Void
+--E 14
+
+--S 15
+incfns := [sc**i for i in 0..10]
+--R 
+--R   Compiling function sc with type Fraction Integer -> Fraction Integer
+--R      
+--R
+--R   (15)
+--R   [theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0),
+--R    theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0),
+--R    theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0),
+--R    theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0),
+--R    theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0),
+--R    theMap(MAPPKG1;**;MNniM;6!0,0)]
+--R                            Type: List (Fraction Integer -> Fraction 
Integer)
+--E 15
+
+--S 16
+[f 4 for f in incfns]
+--R 
+--R
+--R   (16)  [4,5,6,7,8,9,10,11,12,13,14]
+--R                                                  Type: List Fraction 
Integer
+--E 16
+
+--S 17
+times(n:NNI, i:INT):INT == n*i
+--R 
+--R   Function declaration times : (NonNegativeInteger,Integer) -> Integer
+--R      has been added to workspace.
+--R                                                                   Type: 
Void
+--E 17
+
+--S 18
+r := recur(times)
+--R 
+--R   Compiling function times with type (NonNegativeInteger,Integer) -> 
+--R      Integer 
+--R
+--R   (18)  theMap(MAPPKG1;recur;2M;7!0,0)
+--R                              Type: ((NonNegativeInteger,Integer) -> 
Integer)
+--E 18
+
+--S 19
+fact := curryRight(r, 1)
+--R 
+--R
+--R   (19)  theMap(MAPPKG3;curryRight;MBM;1!0,0)
+--R                                        Type: (NonNegativeInteger -> 
Integer)
+--E 19
+
+--S 20
+fact 4
+--R 
+--R
+--R   (20)  24
+--R                                                        Type: 
PositiveInteger
+--E 20
+
+--S 21
+mto2ton(m, n) ==
+  raiser := square^n
+  raiser m
+--R 
+--R                                                                   Type: 
Void
+--E 21
+
+--S 22
+mto2ton(3, 3)
+--R 
+--R   Compiling function mto2ton with type (PositiveInteger,
+--R      PositiveInteger) -> Fraction Integer 
+--R
+--R   (22)  6561
+--R                                                       Type: Fraction 
Integer
+--E 22
+
+--S 23
+shiftfib(r: List INT) : INT ==
+  t := r.1
+  r.1 := r.2
+  r.2 := r.2 + t
+  t
+--R 
+--R   Function declaration shiftfib : List Integer -> Integer has been 
+--R      added to workspace.
+--R                                                                   Type: 
Void
+--E 23
+
+--S 24
+fibinit: List INT := [0, 1]
+--R 
+--R
+--R   (24)  [0,1]
+--R                                                           Type: List 
Integer
+--E 24
+
+--S 25
+fibs := curry(shiftfib, fibinit)
+--R 
+--R   Compiling function shiftfib with type List Integer -> Integer 
+--R
+--R   (25)  theMap(MAPPKG2;curry;MAM;2!0,0)
+--R                                                        Type: (() -> 
Integer)
+--E 25
+
+--S 26
+[fibs() for i in 0..30]
+--R 
+--R
+--R   (26)
+--R   [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597,
+--R    2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418,
+--R    317811, 514229, 832040]
+--R                                                           Type: List 
Integer
+--E 26
+)spool
+)lisp (bye)
+@
+<<MappingPackage3.help>>=
+====================================================================
+MappingPackage examples
+====================================================================
+
+Function are objects of type Mapping.  In this section we demonstrate
+some library operations from the packages MappingPackage1, MappingPackage2, 
+and MappingPackage3 that manipulate and create functions. Some terminology: 
+a nullary function takes no arguments, a unary function takes one argument, 
+and a binary function takes two arguments.
+
+We begin by creating an example function that raises a rational number
+to an integer exponent.
+
+  power(q: FRAC INT, n: INT): FRAC INT == q**n
+                      Type: Void
+
+  power(2,3)
+    8
+                       Type: Fraction Integer
+
+The twist operation transposes the arguments of a binary function.
+Here rewop(a, b) is power(b, a).
+
+  rewop := twist power
+    theMap(MAPPKG3;twist;MM;5!0)
+                       Type: ((Integer,Fraction Integer) -> Fraction Integer)
+
+This is 2^3.
+
+  rewop(3, 2)
+    8
+                       Type: Fraction Integer
+
+Now we define square in terms of power.
+
+  square: FRAC INT -> FRAC INT
+                       Type: Void
+The curryRight operation creates a unary function from a binary one by
+providing a constant argument on the right.
+
+  square:= curryRight(power, 2)
+    theMap(MAPPKG3;curryRight;MBM;1!0,0)
+                       Type: (Fraction Integer -> Fraction Integer)
+
+Likewise, the curryLeft operation provides a constant argument on the
+left.
+
+  square 4
+    16
+                       Type: Fraction Integer
+
+The constantRight operation creates (in a trivial way) a binary
+function from a unary one: constantRight(f) is the function g such
+that g(a,b)= f(a).
+
+  squirrel:= constantRight(square)$MAPPKG3(FRAC INT,FRAC INT,FRAC INT)
+    theMap(MAPPKG3;constantRight;MM;3!0)
+              Type: ((Fraction Integer,Fraction Integer) -> Fraction Integer)
+
+Likewise, constantLeft(f) is the function g such that g(a,b)= f(b).
+
+  squirrel(1/2, 1/3)
+    1
+    -
+    4
+                       Type: Fraction Integer
+
+The curry operation makes a unary function nullary.
+
+  sixteen := curry(square, 4/1)
+    theMap(MAPPKG2;curry;MAM;2!0,0)
+                       Type: (() -> Fraction Integer)
+
+  sixteen()
+    16
+                       Type: Fraction Integer
+
+The * operation constructs composed functions.
+
+  square2:=square*square
+    theMap(MAPPKG3;*;MMM;6!0,0)
+                       Type: (Fraction Integer -> Fraction Integer)
+
+  square2 3
+    81
+                       Type: Fraction Integer
+
+Use the ** operation to create functions that are n-fold iterations of
+other functions.
+
+  sc(x: FRAC INT): FRAC INT == x + 1
+                       Type: Void
+
+This is a list of Mapping objects.
+
+  incfns := [sc**i for i in 0..10]
+   [theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0),
+    theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0),
+    theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0),
+    theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0),
+    theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0),
+    theMap(MAPPKG1;**;MNniM;6!0,0)]
+                       Type: List (Fraction Integer -> Fraction Integer)
+
+This is a list of applications of those functions.
+
+  [f 4 for f in incfns]
+    [4,5,6,7,8,9,10,11,12,13,14]
+                       Type: List Fraction Integer
+
+Use the recur operation for recursion:
+
+  g := recur f means g(n,x) == f(n,f(n-1,...f(1,x))).
+
+  times(n:NNI, i:INT):INT == n*i
+                       Type: Void
+
+  r := recur(times)
+    theMap(MAPPKG1;recur;2M;7!0,0)
+                       Type: ((NonNegativeInteger,Integer) -> Integer)
+
+This is a factorial function.
+
+  fact := curryRight(r, 1)
+    theMap(MAPPKG3;curryRight;MBM;1!0,0)
+                       Type: (NonNegativeInteger -> Integer)
+
+  fact 4
+    24
+                       Type: PositiveInteger
+
+Constructed functions can be used within other functions.
+
+  mto2ton(m, n) ==
+    raiser := square^n
+    raiser m
+                       Type: Void
+
+This is 3^(2^3).
+
+  mto2ton(3, 3)
+    6561
+                       Type: Fraction Integer
+
+Here shiftfib is a unary function that modifies its argument.
+
+  shiftfib(r: List INT) : INT ==
+    t := r.1
+    r.1 := r.2
+    r.2 := r.2 + t
+    t
+                       Type: Void
+
+By currying over the argument we get a function with private state.
+
+  fibinit: List INT := [0, 1]
+    [0,1]
+                       Type: List Integer
+
+  fibs := curry(shiftfib, fibinit)
+    theMap(MAPPKG2;curry;MAM;2!0,0)
+                       Type: (() -> Integer)
+
+  [fibs() for i in 0..30]
+   [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597,
+    2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418,
+    317811, 514229, 832040]
+                       Type: List Integer
+
+See Also:
+o )help MappingPackage1
+o )help MappingPackage2
+o )show MappingPackage3
+o $AXIOM/doc/src/algebra/mappkg.spad.dvi
+
+@
 <<package MAPPKG3 MappingPackage3>>=
 )abbrev package MAPPKG3 MappingPackage3
 ++ Description: various Currying operations.
diff --git a/src/algebra/matrix.spad.pamphlet b/src/algebra/matrix.spad.pamphlet
index 3704e00..7b7a10f 100644
--- a/src/algebra/matrix.spad.pamphlet
+++ b/src/algebra/matrix.spad.pamphlet
@@ -78,6 +78,918 @@ IndexedMatrix(R,mnRow,mnCol): Exports == Implementation 
where
 
 @
 \section{domain MATRIX Matrix}
+<<Matrix.input>>=
+-- matrix.spad.pamphlet Matrix.input
+)spool Matrix.output
+)set message test on
+)set message auto off
+)clear all
+--S 1 of 38
+m : Matrix(Integer) := new(3,3,0)
+--R 
+--R
+--R        +0  0  0+
+--R        |       |
+--R   (1)  |0  0  0|
+--R        |       |
+--R        +0  0  0+
+--R                                                         Type: Matrix 
Integer
+--E 1
+
+--S 2 of 38
+setelt(m,2,3,5)
+--R 
+--R
+--R   (2)  5
+--R                                                        Type: 
PositiveInteger
+--E 2
+
+--S 3 of 38
+m(1,2) := 10
+--R 
+--R
+--R   (3)  10
+--R                                                        Type: 
PositiveInteger
+--E 3
+
+--S 4 of 38
+m
+--R 
+--R
+--R        +0  10  0+
+--R        |        |
+--R   (4)  |0  0   5|
+--R        |        |
+--R        +0  0   0+
+--R                                                         Type: Matrix 
Integer
+--E 4
+
+--S 5 of 38
+matrix [ [1,2,3,4],[0,9,8,7] ]
+--R 
+--R
+--R        +1  2  3  4+
+--R   (5)  |          |
+--R        +0  9  8  7+
+--R                                                         Type: Matrix 
Integer
+--E 5
+
+--S 6 of 38
+dm := diagonalMatrix [1,x**2,x**3,x**4,x**5]
+--R 
+--R
+--R        +1  0   0   0   0 +
+--R        |                 |
+--R        |    2            |
+--R        |0  x   0   0   0 |
+--R        |                 |
+--R        |        3        |
+--R   (6)  |0  0   x   0   0 |
+--R        |                 |
+--R        |            4    |
+--R        |0  0   0   x   0 |
+--R        |                 |
+--R        |                5|
+--R        +0  0   0   0   x +
+--R                                              Type: Matrix Polynomial 
Integer
+--E 6
+
+--S 7 of 38
+setRow!(dm,5,vector [1,1,1,1,1])
+--R 
+--R
+--R        +1  0   0   0   0+
+--R        |                |
+--R        |    2           |
+--R        |0  x   0   0   0|
+--R        |                |
+--R   (7)  |        3       |
+--R        |0  0   x   0   0|
+--R        |                |
+--R        |            4   |
+--R        |0  0   0   x   0|
+--R        |                |
+--R        +1  1   1   1   1+
+--R                                              Type: Matrix Polynomial 
Integer
+--E 7
+
+--S 8 of 38
+setColumn!(dm,2,vector [y,y,y,y,y])
+--R 
+--R
+--R        +1  y  0   0   0+
+--R        |               |
+--R        |0  y  0   0   0|
+--R        |               |
+--R        |       3       |
+--R   (8)  |0  y  x   0   0|
+--R        |               |
+--R        |           4   |
+--R        |0  y  0   x   0|
+--R        |               |
+--R        +1  y  1   1   1+
+--R                                              Type: Matrix Polynomial 
Integer
+--E 8
+
+--S 9 of 38
+cdm := copy(dm)
+--R 
+--R
+--R        +1  y  0   0   0+
+--R        |               |
+--R        |0  y  0   0   0|
+--R        |               |
+--R        |       3       |
+--R   (9)  |0  y  x   0   0|
+--R        |               |
+--R        |           4   |
+--R        |0  y  0   x   0|
+--R        |               |
+--R        +1  y  1   1   1+
+--R                                              Type: Matrix Polynomial 
Integer
+--E 9
+
+--S 10 of 38
+setelt(dm,4,1,1-x**7)
+--R 
+--R
+--R            7
+--R   (10)  - x  + 1
+--R                                                     Type: Polynomial 
Integer
+--E 10
+
+--S 11 of 38
+[dm,cdm]
+--R 
+--R
+--R          +   1      y  0   0   0+ +1  y  0   0   0+
+--R          |                      | |               |
+--R          |   0      y  0   0   0| |0  y  0   0   0|
+--R          |                      | |               |
+--R          |              3       | |       3       |
+--R   (11)  [|   0      y  x   0   0|,|0  y  x   0   0|]
+--R          |                      | |               |
+--R          |   7              4   | |           4   |
+--R          |- x  + 1  y  0   x   0| |0  y  0   x   0|
+--R          |                      | |               |
+--R          +   1      y  1   1   1+ +1  y  1   1   1+
+--R                                         Type: List Matrix Polynomial 
Integer
+--E 11
+
+--S 12 of 38
+subMatrix(dm,2,3,2,4)
+--R 
+--R
+--R         +y  0   0+
+--R   (12)  |        |
+--R         |    3   |
+--R         +y  x   0+
+--R                                              Type: Matrix Polynomial 
Integer
+--E 12
+
+--S 13 of 38
+d := diagonalMatrix [1.2,-1.3,1.4,-1.5]
+--R 
+--R
+--R         +1.2   0.0   0.0   0.0 +
+--R         |                      |
+--R         |0.0  - 1.3  0.0   0.0 |
+--R   (13)  |                      |
+--R         |0.0   0.0   1.4   0.0 |
+--R         |                      |
+--R         +0.0   0.0   0.0  - 1.5+
+--R                                                           Type: Matrix 
Float
+--E 13
+
+--S 14 of 38
+e := matrix [ [6.7,9.11],[-31.33,67.19] ]
+--R 
+--R
+--R         +  6.7    9.11 +
+--R   (14)  |              |
+--R         +- 31.33  67.19+
+--R                                                           Type: Matrix 
Float
+--E 14
+
+--S 15 of 38
+setsubMatrix!(d,1,2,e)
+--R 
+--R
+--R         +1.2    6.7    9.11    0.0 +
+--R         |                          |
+--R         |0.0  - 31.33  67.19   0.0 |
+--R   (15)  |                          |
+--R         |0.0    0.0     1.4    0.0 |
+--R         |                          |
+--R         +0.0    0.0     0.0   - 1.5+
+--R                                                           Type: Matrix 
Float
+--E 15
+
+--S 16 of 38
+d
+--R 
+--R
+--R         +1.2    6.7    9.11    0.0 +
+--R         |                          |
+--R         |0.0  - 31.33  67.19   0.0 |
+--R   (16)  |                          |
+--R         |0.0    0.0     1.4    0.0 |
+--R         |                          |
+--R         +0.0    0.0     0.0   - 1.5+
+--R                                                           Type: Matrix 
Float
+--E 16
+
+--S 17 of 38
+a := matrix [ [1/2,1/3,1/4],[1/5,1/6,1/7] ]
+--R 
+--R
+--R         +1  1  1+
+--R         |-  -  -|
+--R         |2  3  4|
+--R   (17)  |       |
+--R         |1  1  1|
+--R         |-  -  -|
+--R         +5  6  7+
+--R                                                Type: Matrix Fraction 
Integer
+--E 17
+
+--S 18 of 38
+b := matrix [ [3/5,3/7,3/11],[3/13,3/17,3/19] ] 
+--R 
+--R
+--R         +3   3    3+
+--R         |-   -   --|
+--R         |5   7   11|
+--R   (18)  |          |
+--R         | 3   3   3|
+--R         |--  --  --|
+--R         +13  17  19+
+--R                                                Type: Matrix Fraction 
Integer
+--E 18
+
+--S 19 of 38
+horizConcat(a,b)
+--R 
+--R
+--R         +1  1  1  3   3    3+
+--R         |-  -  -  -   -   --|
+--R         |2  3  4  5   7   11|
+--R   (19)  |                   |
+--R         |1  1  1   3   3   3|
+--R         |-  -  -  --  --  --|
+--R         +5  6  7  13  17  19+
+--R                                                Type: Matrix Fraction 
Integer
+--E 19
+
+--S 20 of 38
+vab := vertConcat(a,b)
+--R 
+--R
+--R         +1   1   1 +
+--R         |-   -   - |
+--R         |2   3   4 |
+--R         |          |
+--R         |1   1   1 |
+--R         |-   -   - |
+--R         |5   6   7 |
+--R   (20)  |          |
+--R         |3   3    3|
+--R         |-   -   --|
+--R         |5   7   11|
+--R         |          |
+--R         | 3   3   3|
+--R         |--  --  --|
+--R         +13  17  19+
+--R                                                Type: Matrix Fraction 
Integer
+--E 20
+
+--S 21 of 38
+transpose vab
+--R 
+--R
+--R         +1  1  3    3+
+--R         |-  -  -   --|
+--R         |2  5  5   13|
+--R         |            |
+--R         |1  1  3    3|
+--R   (21)  |-  -  -   --|
+--R         |3  6  7   17|
+--R         |            |
+--R         |1  1   3   3|
+--R         |-  -  --  --|
+--R         +4  7  11  19+
+--R                                                Type: Matrix Fraction 
Integer
+--E 21
+
+--S 22 of 38
+m := matrix [ [1,2],[3,4] ]
+--R 
+--R
+--R         +1  2+
+--R   (22)  |    |
+--R         +3  4+
+--R                                                         Type: Matrix 
Integer
+--E 22
+
+--S 23 of 38
+4 * m * (-5)
+--R 
+--R
+--R         +- 20  - 40+
+--R   (23)  |          |
+--R         +- 60  - 80+
+--R                                                         Type: Matrix 
Integer
+--E 23
+
+--S 24 of 38
+n := matrix([ [1,0,-2],[-3,5,1] ])
+--R 
+--R
+--R         + 1   0  - 2+
+--R   (24)  |           |
+--R         +- 3  5   1 +
+--R                                                         Type: Matrix 
Integer
+--E 24
+
+--S 25 of 38
+m * n
+--R 
+--R
+--R         +- 5  10   0 +
+--R   (25)  |            |
+--R         +- 9  20  - 2+
+--R                                                         Type: Matrix 
Integer
+--E 25
+
+--S 26 of 38
+vec := column(n,3)
+--R 
+--R
+--R   (26)  [- 2,1]
+--R                                                         Type: Vector 
Integer
+--E 26
+
+--S 27 of 38
+vec * m
+--R 
+--R
+--R   (27)  [1,0]
+--R                                                         Type: Vector 
Integer
+--E 27
+
+--S 28 of 38
+m * vec
+--R 
+--R
+--R   (28)  [0,- 2]
+--R                                                         Type: Vector 
Integer
+--E 28
+
+--S 29 of 38
+hilb := matrix([ [1/(i + j) for i in 1..3] for j in 1..3])
+--R 
+--R
+--R         +1  1  1+
+--R         |-  -  -|
+--R         |2  3  4|
+--R         |       |
+--R         |1  1  1|
+--R   (29)  |-  -  -|
+--R         |3  4  5|
+--R         |       |
+--R         |1  1  1|
+--R         |-  -  -|
+--R         +4  5  6+
+--R                                                Type: Matrix Fraction 
Integer
+--E 29
+
+--S 30 of 38
+inverse(hilb)
+--R 
+--R
+--R         + 72    - 240   180 +
+--R         |                   |
+--R   (30)  |- 240   900   - 720|
+--R         |                   |
+--R         + 180   - 720   600 +
+--R                                     Type: Union(Matrix Fraction 
Integer,...)
+--E 30
+
+--S 31 of 38
+mm := matrix([ [1,2,3,4], [5,6,7,8], [9,10,11,12], [13,14,15,16] ])
+--R 
+--R
+--R         +1   2   3   4 +
+--R         |              |
+--R         |5   6   7   8 |
+--R   (31)  |              |
+--R         |9   10  11  12|
+--R         |              |
+--R         +13  14  15  16+
+--R                                                         Type: Matrix 
Integer
+--E 31
+
+--S 32 of 38
+inverse(mm)
+--R 
+--R
+--R   (32)  "failed"
+--R                                                    Type: 
Union("failed",...)
+--E 32
+
+--S 33 of 38
+determinant(mm)
+--R 
+--R
+--R   (33)  0
+--R                                                     Type: 
NonNegativeInteger
+--E 33
+
+--S 34 of 38
+trace(mm)
+--R 
+--R
+--R   (34)  34
+--R                                                        Type: 
PositiveInteger
+--E 34
+
+--S 35 of 38
+rank(mm)
+--R 
+--R
+--R   (35)  2
+--R                                                        Type: 
PositiveInteger
+--E 35
+
+--S 36 of 38
+nullity(mm)
+--R 
+--R
+--R   (36)  2
+--R                                                        Type: 
PositiveInteger
+--E 36
+
+--S 37 of 38
+nullSpace(mm)
+--R 
+--R
+--R   (37)  [[1,- 2,1,0],[2,- 3,0,1]]
+--R                                                    Type: List Vector 
Integer
+--E 37
+
+--S 38 of 38
+rowEchelon(mm)
+--R 
+--R
+--R         +1  2  3  4 +
+--R         |           |
+--R         |0  4  8  12|
+--R   (38)  |           |
+--R         |0  0  0  0 |
+--R         |           |
+--R         +0  0  0  0 +
+--R                                                         Type: Matrix 
Integer
+--E 38
+)spool
+)lisp (bye)
+@
+<<Matrix.help>>=
+====================================================================
+Matrix examples
+====================================================================
+
+The Matrix domain provides arithmetic operations on matrices
+and standard functions from linear algebra.
+This domain is similar to the TwoDimensionalArray domain, except
+that the entries for Matrix must belong to a  Ring.
+
+====================================================================
+Creating Matrices
+====================================================================
+
+There are many ways to create a matrix from a collection of values or
+from existing matrices.
+
+If the matrix has almost all items equal to the same value, use new to
+create a matrix filled with that value and then reset the entries that
+are different.
+
+  m : Matrix(Integer) := new(3,3,0)
+    +0  0  0+
+    |       |
+    |0  0  0|
+    |       |
+    +0  0  0+
+                      Type: Matrix Integer
+
+To change the entry in the second row, third column to 5, use setelt.
+
+  setelt(m,2,3,5)
+    5
+                      Type: PositiveInteger
+
+An alternative syntax is to use assignment.
+
+  m(1,2) := 10
+    10
+                      Type: PositiveInteger
+
+The matrix was destructively modified.
+
+  m
+    +0  10  0+
+    |        |
+    |0  0   5|
+    |        |
+    +0  0   0+
+                      Type: Matrix Integer
+
+If you already have the matrix entries as a list of lists, use matrix.
+
+  matrix [ [1,2,3,4],[0,9,8,7] ]
+    +1  2  3  4+
+    |          |
+    +0  9  8  7+
+                      Type: Matrix Integer
+
+If the matrix is diagonal, use diagonalMatrix.
+
+  dm := diagonalMatrix [1,x**2,x**3,x**4,x**5]
+        +1  0   0   0   0 +
+        |                 |
+        |    2            |
+        |0  x   0   0   0 |
+        |                 |
+        |        3        |
+        |0  0   x   0   0 |
+        |                 |
+        |            4    |
+        |0  0   0   x   0 |
+        |                 |
+        |                5|
+        +0  0   0   0   x +
+                     Type: Matrix Polynomial Integer
+
+Use setRow and setColumn to change a row or column of a matrix.
+
+  setRow!(dm,5,vector [1,1,1,1,1])
+        +1  0   0   0   0+
+        |                |
+        |    2           |
+        |0  x   0   0   0|
+        |                |
+        |        3       |
+        |0  0   x   0   0|
+        |                |
+        |            4   |
+        |0  0   0   x   0|
+        |                |
+        +1  1   1   1   1+
+                    Type: Matrix Polynomial Integer
+
+  setColumn!(dm,2,vector [y,y,y,y,y])
+        +1  y  0   0   0+
+        |               |
+        |0  y  0   0   0|
+        |               |
+        |       3       |
+        |0  y  x   0   0|
+        |               |
+        |           4   |
+        |0  y  0   x   0|
+        |               |
+        +1  y  1   1   1+
+                    Type: Matrix Polynomial Integer
+
+Use copy to make a copy of a matrix.
+
+  cdm := copy(dm)
+        +1  y  0   0   0+
+        |               |
+        |0  y  0   0   0|
+        |               |
+        |       3       |
+        |0  y  x   0   0|
+        |               |
+        |           4   |
+        |0  y  0   x   0|
+        |               |
+        +1  y  1   1   1+
+                    Type: Matrix Polynomial Integer
+
+This is useful if you intend to modify a matrix destructively but
+want a copy of the original.
+
+  setelt(dm,4,1,1-x**7)
+        7
+     - x  + 1
+                    Type: Polynomial Integer
+
+  [dm,cdm]
+          +   1      y  0   0   0+ +1  y  0   0   0+
+          |                      | |               |
+          |   0      y  0   0   0| |0  y  0   0   0|
+          |                      | |               |
+          |              3       | |       3       |
+         [|   0      y  x   0   0|,|0  y  x   0   0|]
+          |                      | |               |
+          |   7              4   | |           4   |
+          |- x  + 1  y  0   x   0| |0  y  0   x   0|
+          |                      | |               |
+          +   1      y  1   1   1+ +1  y  1   1   1+
+                     Type: List Matrix Polynomial Integer
+
+Use subMatrix to extract part of an existing matrix.  The syntax is 
+subMatrix(m, firstrow, lastrow, firstcol, lastcol).
+
+  subMatrix(dm,2,3,2,4)
+         +y  0   0+
+         |        |
+         |    3   |
+         +y  x   0+
+                     Type: Matrix Polynomial Integer
+
+To change a submatrix, use setsubMatrix.
+
+  d := diagonalMatrix [1.2,-1.3,1.4,-1.5]
+         +1.2   0.0   0.0   0.0 +
+         |                      |
+         |0.0  - 1.3  0.0   0.0 |
+         |                      |
+         |0.0   0.0   1.4   0.0 |
+         |                      |
+         +0.0   0.0   0.0  - 1.5+
+                     Type: Matrix Float
+
+If e is too big to fit where you specify, an error message is
+displayed.  Use subMatrix to extract part of e, if necessary.
+
+  e := matrix [ [6.7,9.11],[-31.33,67.19] ]
+         +  6.7    9.11 +
+         |              |
+         +- 31.33  67.19+
+                      Type: Matrix Float
+
+This changes the submatrix of d whose upper left corner is at the
+first row and second column and whose size is that of e.
+
+  setsubMatrix!(d,1,2,e)
+         +1.2    6.7    9.11    0.0 +
+         |                          |
+         |0.0  - 31.33  67.19   0.0 |
+         |                          |
+         |0.0    0.0     1.4    0.0 |
+         |                          |
+         +0.0    0.0     0.0   - 1.5+
+                       Type: Matrix Float
+
+  d
+         +1.2    6.7    9.11    0.0 +
+         |                          |
+         |0.0  - 31.33  67.19   0.0 |
+         |                          |
+         |0.0    0.0     1.4    0.0 |
+         |                          |
+         +0.0    0.0     0.0   - 1.5+
+                        Type: Matrix Float
+
+Matrices can be joined either horizontally or vertically to make
+new matrices.
+
+  a := matrix [ [1/2,1/3,1/4],[1/5,1/6,1/7] ]
+         +1  1  1+
+         |-  -  -|
+         |2  3  4|
+         |       |
+         |1  1  1|
+         |-  -  -|
+         +5  6  7+
+                         Type: Matrix Fraction Integer
+
+  b := matrix [ [3/5,3/7,3/11],[3/13,3/17,3/19] ] 
+         +3   3    3+
+         |-   -   --|
+         |5   7   11|
+         |          |
+         | 3   3   3|
+         |--  --  --|
+         +13  17  19+
+                         Type: Matrix Fraction Integer
+
+Use horizConcat to append them side to side.  The two matrices must
+have the same number of rows.
+
+  horizConcat(a,b)
+         +1  1  1  3   3    3+
+         |-  -  -  -   -   --|
+         |2  3  4  5   7   11|
+         |                   |
+         |1  1  1   3   3   3|
+         |-  -  -  --  --  --|
+         +5  6  7  13  17  19+
+                         Type: Matrix Fraction Integer
+
+Use vertConcat to stack one upon the other.  The two matrices must
+have the same number of columns.
+
+  vab := vertConcat(a,b)
+         +1   1   1 +
+         |-   -   - |
+         |2   3   4 |
+         |          |
+         |1   1   1 |
+         |-   -   - |
+         |5   6   7 |
+         |          |
+         |3   3    3|
+         |-   -   --|
+         |5   7   11|
+         |          |
+         | 3   3   3|
+         |--  --  --|
+         +13  17  19+
+                         Type: Matrix Fraction Integer
+
+The operation transpose is used to create a new matrix by reflection
+across the main diagonal.
+
+  transpose vab
+         +1  1  3    3+
+         |-  -  -   --|
+         |2  5  5   13|
+         |            |
+         |1  1  3    3|
+         |-  -  -   --|
+         |3  6  7   17|
+         |            |
+         |1  1   3   3|
+         |-  -  --  --|
+         +4  7  11  19+
+                         Type: Matrix Fraction Integer
+
+====================================================================
+Operations on Matrices
+====================================================================
+
+Axiom provides both left and right scalar multiplication.
+
+  m := matrix [ [1,2],[3,4] ]
+         +1  2+
+         |    |
+         +3  4+
+                          Type: Matrix Integer
+
+  4 * m * (-5)
+         +- 20  - 40+
+         |          |
+         +- 60  - 80+
+                          Type: Matrix Integer
+
+You can add, subtract, and multiply matrices provided, of course, that
+the matrices have compatible dimensions.  If not, an error message is
+displayed.
+
+  n := matrix([ [1,0,-2],[-3,5,1] ])
+         + 1   0  - 2+
+         |           |
+         +- 3  5   1 +
+                          Type: Matrix Integer
+
+This following product is defined but n * m is not.
+
+  m * n
+         +- 5  10   0 +
+         |            |
+         +- 9  20  - 2+
+                          Type: Matrix Integer
+
+The operations nrows and ncols return the number of rows and columns
+of a matrix.  You can extract a row or a column of a matrix using the
+operations row and column.  The object returned is a Vector.
+
+Here is the third column of the matrix n.
+
+  vec := column(n,3)
+     [- 2,1]
+                          Type: Vector Integer
+
+You can multiply a matrix on the left by a "row vector" and on the right
+by a "column vector".
+
+  vec * m
+     [1,0]
+                          Type: Vector Integer
+
+Of course, the dimensions of the vector and the matrix must be compatible
+or an error message is returned.
+
+  m * vec
+    [0,- 2]
+                          Type: Vector Integer
+
+The operation inverse computes the inverse of a matrix if the matrix
+is invertible, and returns "failed" if not.
+
+This Hilbert matrix is invertible.
+
+  hilb := matrix([ [1/(i + j) for i in 1..3] for j in 1..3])
+         +1  1  1+
+         |-  -  -|
+         |2  3  4|
+         |       |
+         |1  1  1|
+         |-  -  -|
+         |3  4  5|
+         |       |
+         |1  1  1|
+         |-  -  -|
+         +4  5  6+
+                          Type: Matrix Fraction Integer
+
+  inverse(hilb)
+         + 72    - 240   180 +
+         |                   |
+         |- 240   900   - 720|
+         |                   |
+         + 180   - 720   600 +
+                          Type: Union(Matrix Fraction Integer,...)
+
+This matrix is not invertible.
+
+  mm := matrix([ [1,2,3,4], [5,6,7,8], [9,10,11,12], [13,14,15,16] ])
+         +1   2   3   4 +
+         |              |
+         |5   6   7   8 |
+         |              |
+         |9   10  11  12|
+         |              |
+         +13  14  15  16+
+                           Type: Matrix Integer
+
+  inverse(mm)
+     "failed"
+                           Type: Union("failed",...)
+
+The operation determinant computes the determinant of a matrix
+provided that the entries of the matrix belong to a CommutativeRing.
+
+The above matrix mm is not invertible and, hence, must have determinant 0.
+
+  determinant(mm)
+    0
+                           Type: NonNegativeInteger
+
+The operation trace computes the trace of a square matrix.
+
+  trace(mm)
+    34
+                           Type: PositiveInteger
+
+The operation rank computes the rank of a matrix: the maximal number
+of linearly independent rows or columns.
+
+  rank(mm)
+    2
+                           Type: PositiveInteger
+
+The operation nullity computes the nullity of a matrix: the dimension
+of its null space.
+
+  nullity(mm)
+    2
+                           Type: PositiveInteger
+
+The operation nullSpace returns a list containing a basis for the null
+space of a matrix.  Note that the nullity is the number of elements in
+a basis for the null space.
+
+  nullSpace(mm)
+    [[1,- 2,1,0],[2,- 3,0,1]]
+                           Type: List Vector Integer
+
+The operation rowEchelon returns the row echelon form of a matrix.  It
+is easy to see that the rank of this matrix is two and that its
+nullity is also two.
+
+  rowEchelon(mm)
+         +1  2  3  4 +
+         |           |
+         |0  4  8  12|
+         |           |
+         |0  0  0  0 |
+         |           |
+         +0  0  0  0 +
+                           Type: Matrix Integer
+
+See Also
+o )help OneDimensionalArray
+o )help TwoDimensionalArray
+o )help Vector
+o )help Permanent
+o )show Matrix
+o $AXIOM/doc/src/algebra/matrix.spad.dvi
+
+@
 <<domain MATRIX Matrix>>=
 )abbrev domain MATRIX Matrix
 ++ Author: Grabmeier, Gschnitzer, Williamson
diff --git a/src/algebra/mkfunc.spad.pamphlet b/src/algebra/mkfunc.spad.pamphlet
index 7b1ad3e..e6db6f4 100644
--- a/src/algebra/mkfunc.spad.pamphlet
+++ b/src/algebra/mkfunc.spad.pamphlet
@@ -219,6 +219,213 @@ InputFormFunctions1(R:Type):with
 
 @
 \section{package MKFUNC MakeFunction}
+<<MakeFunction.input>>=
+-- mkfunc.spad.pamphlet MakeFunction.input
+)spool MakeFunction.output
+)set message test on
+)set message auto off
+)clear all
+--S 1 of 9
+expr := (x - exp x + 1)^2 * (sin(x^2) * x + 1)^3
+--R 
+--R
+--R   (1)
+--R       3   x 2        4     3   x    5     4    3      2 3
+--R     (x (%e )  + (- 2x  - 2x )%e  + x  + 2x  + x )sin(x )
+--R   + 
+--R        2   x 2        3     2   x     4     3     2      2 2
+--R     (3x (%e )  + (- 6x  - 6x )%e  + 3x  + 6x  + 3x )sin(x )
+--R   + 
+--R            x 2        2        x     3     2           2       x 2
+--R     (3x (%e )  + (- 6x  - 6x)%e  + 3x  + 6x  + 3x)sin(x ) + (%e )
+--R   + 
+--R                 x    2
+--R     (- 2x - 2)%e  + x  + 2x + 1
+--R                                                     Type: Expression 
Integer
+--E 1
+
+--S 2 of 9
+function(expr, f, x)
+--R 
+--R
+--R   (2)  f
+--R                                                                 Type: 
Symbol
+--E 2
+
+--S 3 of 9
+tbl := [f(0.1 * i - 1) for i in 0..20]
+--R 
+--R   Compiling function f with type Float -> Float 
+--R
+--R   (3)
+--R   [0.0005391844 0362701574, 0.0039657551 1844206653,
+--R    0.0088545187 4833983689 2, 0.0116524883 0907069695,
+--R    0.0108618220 9245751364 5, 0.0076366823 2120869965 06,
+--R    0.0040584985 7597822062 55, 0.0015349542 8910500836 48,
+--R    0.0003424903 1549879905 716, 0.0000233304 8276098819 6001, 0.0,
+--R    0.0000268186 8782862599 4229, 0.0004691571 3720051642 621,
+--R    0.0026924576 5968519586 08, 0.0101486881 7369135148 8,
+--R    0.0313833725 8543810564 3, 0.0876991144 5154615297 9,
+--R    0.2313019789 3439968362, 0.5843743955 958098772, 1.4114930171 992819197,
+--R    3.2216948276 75164252]
+--R                                                             Type: List 
Float
+--E 3
+
+--S 4 of 9
+e := (x - y + 1)^2 * (x^2 * y + 1)^2 
+--R 
+--R
+--R   (4)
+--R      4 4        5     4     2  3     6     5    4     3     2      2
+--R     x y  + (- 2x  - 2x  + 2x )y  + (x  + 2x  + x  - 4x  - 4x  + 1)y
+--R   + 
+--R        4     3     2               2
+--R     (2x  + 4x  + 2x  - 2x - 2)y + x  + 2x + 1
+--R                                                     Type: Polynomial 
Integer
+--E 4
+
+--S 5 of 9
+function(e, g, [x, y])
+--R 
+--R
+--R   (5)  g
+--R                                                                 Type: 
Symbol
+--E 5
+
+--S 6 of 9
+function(e, h, x, y)
+--R 
+--R
+--R   (6)  h
+--R                                                                 Type: 
Symbol
+--E 6
+
+--S 7 of 9
+m1 := squareMatrix [ [1, 2], [3, 4] ]
+--R 
+--R
+--R        +1  2+
+--R   (7)  |    |
+--R        +3  4+
+--R                                                Type: 
SquareMatrix(2,Integer)
+--E 7
+
+--S 8 of 9
+m2 := squareMatrix [ [1, 0], [-1, 1] ]
+--R 
+--R
+--R        + 1   0+
+--R   (8)  |      |
+--R        +- 1  1+
+--R                                                Type: 
SquareMatrix(2,Integer)
+--E 8
+
+--S 9 of 9
+h(m1, m2)
+--R 
+--R   Compiling function h with type (SquareMatrix(2,Integer),SquareMatrix
+--R      (2,Integer)) -> SquareMatrix(2,Integer) 
+--R
+--R        +- 7836   8960 +
+--R   (9)  |              |
+--R        +- 17132  19588+
+--R                                                Type: 
SquareMatrix(2,Integer)
+--E 9
+)spool
+)lisp (bye)
+@
+<<MakeFunction.help>>=
+====================================================================
+MakeFunction examples
+====================================================================
+
+It is sometimes useful to be able to define a function given by
+the result of a calculation.
+
+Suppose that you have obtained the following expression after several
+computations and that you now want to tabulate the numerical values of
+f for x between -1 and +1 with increment 0.1.
+
+  expr := (x - exp x + 1)^2 * (sin(x^2) * x + 1)^3
+       3   x 2        4     3   x    5     4    3      2 3
+     (x (%e )  + (- 2x  - 2x )%e  + x  + 2x  + x )sin(x )
+   + 
+        2   x 2        3     2   x     4     3     2      2 2
+     (3x (%e )  + (- 6x  - 6x )%e  + 3x  + 6x  + 3x )sin(x )
+   + 
+            x 2        2        x     3     2           2       x 2
+     (3x (%e )  + (- 6x  - 6x)%e  + 3x  + 6x  + 3x)sin(x ) + (%e )
+   + 
+                 x    2
+     (- 2x - 2)%e  + x  + 2x + 1
+                               Type: Expression Integer
+
+You could, of course, use the function eval within a loop and evaluate
+expr twenty-one times, but this would be quite slow.  A better way is
+to create a numerical function f such that f(x) is defined by the
+expression expr above, but without retyping expr!  The package
+MakeFunction provides the operation function which does exactly this.
+
+Issue this to create the function f(x) given by expr.
+
+  function(expr, f, x)
+    f
+                               Type: Symbol
+
+To tabulate expr, we can now quickly evaluate f 21 times.
+
+  tbl := [f(0.1 * i - 1) for i in 0..20];
+                               Type: List Float
+
+Use the list [x1,...,xn] as the third argument to function to create a
+multivariate function f(x1,...,xn).
+
+  e := (x - y + 1)^2 * (x^2 * y + 1)^2 
+      4 4        5     4     2  3     6     5    4     3     2      2
+     x y  + (- 2x  - 2x  + 2x )y  + (x  + 2x  + x  - 4x  - 4x  + 1)y
+   + 
+        4     3     2               2
+     (2x  + 4x  + 2x  - 2x - 2)y + x  + 2x + 1
+                                Type: Polynomial Integer
+
+  function(e, g, [x, y])
+    g
+                               Type: Symbol
+
+In the case of just two variables, they can be given as arguments
+without making them into a list.
+
+  function(e, h, x, y)
+    h
+                               Type: Symbol
+
+Note that the functions created by function are not limited to
+floating point numbers, but can be applied to any type for which they
+are defined.
+
+  m1 := squareMatrix [ [1, 2], [3, 4] ]
+    +1  2+
+    |    |
+    +3  4+
+                               Type: SquareMatrix(2,Integer)
+
+  m2 := squareMatrix [ [1, 0], [-1, 1] ]
+    + 1   0+
+    |      |
+    +- 1  1+
+                               Type: SquareMatrix(2,Integer)
+
+  h(m1, m2)
+    +- 7836   8960 +
+    |              |
+    +- 17132  19588+
+                               Type: SquareMatrix(2,Integer)
+
+See Also:
+o )show MakeFunction
+o $AXIOM/doc/src/algebra/mkfunc.spad.dvi
+
+@
 <<package MKFUNC MakeFunction>>=
 )abbrev package MKFUNC MakeFunction
 ++ Tools for making interpreter functions from top-level expressions
diff --git a/src/algebra/mset.spad.pamphlet b/src/algebra/mset.spad.pamphlet
index abe5d56..f6a63fd 100644
--- a/src/algebra/mset.spad.pamphlet
+++ b/src/algebra/mset.spad.pamphlet
@@ -10,6 +10,221 @@
 \tableofcontents
 \eject
 \section{domain MSET Multiset}
+<<Multiset.input>>=
+-- mset.spad.pamphlet Multiset.input
+)spool Multiset.output
+)set message test on
+)set message auto off
+)clear all
+--S 1 of 14
+s := multiset [1,2,3,4,5,4,3,2,3,4,5,6,7,4,10]
+--R 
+--R
+--R   (1)  {1,2: 2,3: 3,4: 4,2: 5,6,7,10}
+--R                                               Type: Multiset 
PositiveInteger
+--E 1
+
+--S 2 of 14
+insert!(3,s)
+--R 
+--R
+--R   (2)  {1,2: 2,4: 3,4: 4,2: 5,6,7,10}
+--R                                               Type: Multiset 
PositiveInteger
+--E 2
+
+--S 3 of 14
+remove!(3,s,1)
+--R 
+--R
+--R   (3)  {1,2: 2,3: 3,4: 4,2: 5,6,7,10}
+--R                                               Type: Multiset 
PositiveInteger
+--E 3
+
+--S 4 of 14
+s
+--R 
+--R
+--R   (4)  {1,2: 2,3: 3,4: 4,2: 5,6,7,10}
+--R                                               Type: Multiset 
PositiveInteger
+--E 4
+
+--S 5 of 14
+remove!(5,s)
+--R 
+--R
+--R   (5)  {1,2: 2,3: 3,4: 4,6,7,10}
+--R                                               Type: Multiset 
PositiveInteger
+--E 5
+
+--S 6 of 14
+s
+--R 
+--R
+--R   (6)  {1,2: 2,3: 3,4: 4,6,7,10}
+--R                                               Type: Multiset 
PositiveInteger
+--E 6
+
+--S 7 of 14
+count(5,s)
+--R 
+--R
+--R   (7)  0
+--R                                                     Type: 
NonNegativeInteger
+--E 7
+
+--S 8 of 14
+t := multiset [2,2,2,-9]
+--R 
+--R
+--R   (8)  {3: 2,- 9}
+--R                                                       Type: Multiset 
Integer
+--E 8
+
+--S 9 of 14
+U := union(s,t)
+--R 
+--R
+--R   (9)  {1,5: 2,3: 3,4: 4,6,7,10,- 9}
+--R                                                       Type: Multiset 
Integer
+--E 9
+
+--S 10 of 14
+I := intersect(s,t)
+--R 
+--R
+--R   (10)  {5: 2}
+--R                                                       Type: Multiset 
Integer
+--E 10
+
+--S 11 of 14
+difference(s,t)
+--R 
+--R
+--R   (11)  {1,3: 3,4: 4,6,7,10}
+--R                                                       Type: Multiset 
Integer
+--E 11
+
+--S 12 of 14
+S := symmetricDifference(s,t)
+--R 
+--R
+--R   (12)  {1,3: 3,4: 4,6,7,10,- 9}
+--R                                                       Type: Multiset 
Integer
+--E 12
+
+--S 13 of 14
+(U = union(S,I))@Boolean
+--R 
+--R
+--R   (13)  true
+--R                                                                Type: 
Boolean
+--E 13
+
+--S 14 of 14
+t1 := multiset [1,2,2,3]; [t1 < t, t1 < s, t < s, t1 <= s]
+--R 
+--R
+--R   (14)  [false,true,false,true]
+--R                                                           Type: List 
Boolean
+--E 14
+)spool
+)lisp (bye)
+@
+<<Multiset.help>>=
+====================================================================
+Multiset examples
+====================================================================
+
+The domain Multiset(R) is similar to Set(R) except that multiplicities
+(counts of duplications) are maintained and displayed.  Use the
+operation multiset to create multisets from lists.  All the standard
+operations from sets are available for multisets.  An element with
+multiplicity greater than one has the multiplicity displayed first,
+then a colon, and then the element.
+
+Create a multiset of integers.
+
+  s := multiset [1,2,3,4,5,4,3,2,3,4,5,6,7,4,10]
+    {1,2: 2,3: 3,4: 4,2: 5,6,7,10}
+                          Type: Multiset PositiveInteger
+
+The operation insert! adds an element to a multiset.
+
+  insert!(3,s)
+    {1,2: 2,4: 3,4: 4,2: 5,6,7,10}
+                          Type: Multiset PositiveInteger
+
+Use remove! to remove an element.  If a third argument is present, it
+specifies how many instances to remove. Otherwise all instances of the
+element are removed.  Display the resulting multiset.
+
+  remove!(3,s,1); s
+
+    {1,2: 2,3: 3,4: 4,2: 5,6,7,10}
+                          Type: Multiset PositiveInteger
+
+  remove!(5,s); s
+    {1,2: 2,3: 3,4: 4,6,7,10}
+                          Type: Multiset PositiveInteger
+
+The operation count returns the number of copies of a given value.
+
+  count(5,s)
+    0
+                          Type: NonNegativeInteger
+
+A second multiset.
+
+  t := multiset [2,2,2,-9]
+    {3: 2,- 9}
+                          Type: Multiset Integer
+
+The union of two multisets is additive.
+
+  U := union(s,t)
+    {1,5: 2,3: 3,4: 4,6,7,10,- 9}
+                          Type: Multiset Integer
+
+The intersect operation gives the elements that are in common, with
+additive multiplicity.
+
+  I := intersect(s,t)
+    {5: 2}
+                          Type: Multiset Integer
+
+The difference of s and t consists of the elements that s has but t
+does not.  Elements are regarded as indistinguishable, so that if s
+and t have any element in common, the difference does not contain that
+element.
+
+  difference(s,t)
+    {1,3: 3,4: 4,6,7,10}
+                          Type: Multiset Integer
+
+The symmetricDifference is the union of difference(s, t) and difference(t, s).
+
+  S := symmetricDifference(s,t)
+    {1,3: 3,4: 4,6,7,10,- 9}
+                          Type: Multiset Integer
+
+Check that the union of the symmetricDifference and the intersect
+equals the union of the elements.
+
+  (U = union(S,I))@Boolean
+    true
+                          Type: Boolean
+
+Check some inclusion relations.
+
+  t1 := multiset [1,2,2,3]; [t1 < t, t1 < s, t < s, t1 <= s]
+    [false,true,false,true]
+                          Type: List Boolean
+
+See Also:
+o )show Multiset
+o $AXIOM/doc/src/algebra/mset.spad.dvi
+
+@
 <<domain MSET Multiset>>=
 )abbrev domain MSET Multiset
 ++ Author:Stephen M. Watt, William H. Burge, Richard D. Jenks, Frederic Lehobey
diff --git a/src/algebra/multpoly.spad.pamphlet 
b/src/algebra/multpoly.spad.pamphlet
index 86e5548..76a5624 100644
--- a/src/algebra/multpoly.spad.pamphlet
+++ b/src/algebra/multpoly.spad.pamphlet
@@ -78,6 +78,205 @@ PolynomialFunctions2(R:Ring, S:Ring): with
 
 @
 \section{domain MPOLY MultivariatePolynomial}
+<<MultivariatePolynomial.input>>=
+-- multpoly.spad.pamphlet MultivariatePolynomial.input
+)spool MultivariatePolynomial.output
+)set message test on
+)set message auto off
+)clear all
+--S 1 of 9
+m : MPOLY([x,y],INT) := (x^2 - x*y^3 +3*y)^2
+--R 
+--R
+--R         4     3 3     6       2     4      2
+--R   (1)  x  - 2y x  + (y  + 6y)x  - 6y x + 9y
+--R                                  Type: 
MultivariatePolynomial([x,y],Integer)
+--E 1
+
+--S 2 of 9
+m :: MPOLY([y,x],INT)
+--R 
+--R
+--R         2 6       4     3 3     2     2     4
+--R   (2)  x y  - 6x y  - 2x y  + 9y  + 6x y + x
+--R                                  Type: 
MultivariatePolynomial([y,x],Integer)
+--E 2
+
+--S 3 of 9
+p : MPOLY([x,y],POLY INT)
+--R 
+--R                                                                   Type: 
Void
+--E 3
+
+--S 4 of 9
+p :: POLY INT
+--R 
+--R
+--R   (4)  p
+--R                                                     Type: Polynomial 
Integer
+--E 4
+
+--S 5 of 9
+% :: MPOLY([a,b],POLY INT)
+--R 
+--R
+--R   (5)  p
+--R                       Type: MultivariatePolynomial([a,b],Polynomial 
Integer)
+--E 5
+
+--S 6 of 9
+q : UP(x, FRAC MPOLY([y,z],INT))
+--R 
+--R                                                                   Type: 
Void
+--E 6
+
+--S 7 of 9
+q := (x^2 - x*(z+1)/y +2)^2 
+--R 
+--R
+--R                             2    2
+--R         4   - 2z - 2  3   4y  + z  + 2z + 1  2   - 4z - 4
+--R   (7)  x  + -------- x  + ----------------- x  + -------- x + 4
+--R                 y                  2                 y
+--R                                   y
+--R Type: UnivariatePolynomial(x,Fraction 
MultivariatePolynomial([y,z],Integer))
+--E 7
+
+--S 8 of 9
+q :: UP(z, FRAC MPOLY([x,y],INT))
+--R 
+--R
+--R   (8)
+--R    2            3     2             2 4       3      2      2            2
+--R   x   2   - 2y x  + 2x  - 4y x     y x  - 2y x  + (4y  + 1)x  - 4y x + 4y
+--R   -- z  + -------------------- z + ---------------------------------------
+--R    2                2                                  2
+--R   y                y                                  y
+--R Type: UnivariatePolynomial(z,Fraction 
MultivariatePolynomial([x,y],Integer))
+--E 8
+
+--S 9 of 9
+q :: MPOLY([x,z], FRAC UP(y,INT))
+--R 
+--R
+--R                                               2
+--R         4      2     2  3     1  2    2     4y  + 1  2      4     4
+--R   (9)  x  + (- - z - -)x  + (-- z  + -- z + -------)x  + (- - z - -)x + 4
+--R                y     y        2       2         2           y     y
+--R                              y       y         y
+--R Type: MultivariatePolynomial([x,z],Fraction 
UnivariatePolynomial(y,Integer))
+--E 9
+)spool
+)lisp (bye)
+@
+<<MultivariatePolynomial.help>>=
+====================================================================
+MultivariatePolynomial examples
+====================================================================
+
+The domain constructor MultivariatePolynomial is similar to Polynomial
+except that it specifies the variables to be used.  Polynomial are
+available for MultivariatePolynomial.  The abbreviation for
+MultivariatePolynomial is MPOLY.  The type expressions
+
+  MultivariatePolynomial([x,y],Integer)
+  MPOLY([x,y],INT) 
+
+refer to the domain of multivariate polynomials in the variables x and
+y where the coefficients are restricted to be integers.  The first
+variable specified is the main variable and the display of the polynomial
+reflects this.
+
+This polynomial appears with terms in descending powers of the variable x.
+
+  m : MPOLY([x,y],INT) := (x^2 - x*y^3 +3*y)^2
+     4     3 3     6       2     4      2
+    x  - 2y x  + (y  + 6y)x  - 6y x + 9y
+                     Type: MultivariatePolynomial([x,y],Integer)
+
+It is easy to see a different variable ordering by doing a conversion.
+
+  m :: MPOLY([y,x],INT)
+     2 6       4     3 3     2     2     4
+    x y  - 6x y  - 2x y  + 9y  + 6x y + x
+                     Type: MultivariatePolynomial([y,x],Integer)
+
+You can use other, unspecified variables, by using Polynomial in the
+coefficient type of MPOLY.
+
+  p : MPOLY([x,y],POLY INT)
+                     Type: Void
+
+Conversions can be used to re-express such polynomials in terms of
+the other variables.  For example, you can first push all the
+variables into a polynomial with integer coefficients.
+
+  p :: POLY INT
+    p
+                     Type: Polynomial Integer
+
+Now pull out the variables of interest.
+
+  % :: MPOLY([a,b],POLY INT)
+    p
+                     Type: MultivariatePolynomial([a,b],Polynomial Integer)
+
+Restriction:
+  Axiom does not allow you to create types where MultivariatePolynomial
+  is contained in the coefficient type of Polynomial. Therefore,
+  MPOLY([x,y],POLY INT) is legal but POLY MPOLY([x,y],INT) is not.
+
+Multivariate polynomials may be combined with univariate polynomials
+to create types with special structures.
+
+  q : UP(x, FRAC MPOLY([y,z],INT))
+                          Type: Void
+
+This is a polynomial in x whose coefficients are quotients of polynomials 
+in y and z.
+
+  q := (x^2 - x*(z+1)/y +2)^2 
+                             2    2
+         4   - 2z - 2  3   4y  + z  + 2z + 1  2   - 4z - 4
+   (7)  x  + -------- x  + ----------------- x  + -------- x + 4
+                 y                  2                 y
+                                   y
+ Type: UnivariatePolynomial(x,Fraction MultivariatePolynomial([y,z],Integer))
+
+Use conversions for structural rearrangements. z does not appear in a
+denominator and so it can be made the main variable.
+
+  q :: UP(z, FRAC MPOLY([x,y],INT))
+    2            3     2             2 4       3      2      2            2
+   x   2   - 2y x  + 2x  - 4y x     y x  - 2y x  + (4y  + 1)x  - 4y x + 4y
+   -- z  + -------------------- z + ---------------------------------------
+    2                2                                  2
+   y                y                                  y
+ Type: UnivariatePolynomial(z,Fraction MultivariatePolynomial([x,y],Integer))
+
+Or you can make a multivariate polynomial in x and z whose
+coefficients are fractions in polynomials in y.
+
+  q :: MPOLY([x,z], FRAC UP(y,INT))
+     4      2     2  3     1  2    2     4y  + 1  2      4     4
+    x  + (- - z - -)x  + (-- z  + -- z + -------)x  + (- - z - -)x + 4
+            y     y        2       2         2           y     y
+                          y       y         y
+ Type: MultivariatePolynomial([x,z],Fraction UnivariatePolynomial(y,Integer))
+
+A conversion like q :: MPOLY([x,y], FRAC UP(z,INT)) is not possible in
+this example because y appears in the denominator of a fraction.  As
+you can see, Axiom provides extraordinary flexibility in the
+manipulation and display of expressions via its conversion facility.
+
+See Also:
+o )help DistributedMultivariatePolynomial
+o )help UnivariatePolynomial
+o )help Polynomial
+o )show MultivariatePolynomial
+o $AXIOM/doc/src/algebra/multpoly.spad.dvi
+
+@
 <<domain MPOLY MultivariatePolynomial>>=
 )abbrev domain MPOLY MultivariatePolynomial
 ++ Author: Dave Barton, Barry Trager
diff --git a/src/algebra/oct.spad.pamphlet b/src/algebra/oct.spad.pamphlet
index d515045..c5b85b6 100644
--- a/src/algebra/oct.spad.pamphlet
+++ b/src/algebra/oct.spad.pamphlet
@@ -338,7 +338,243 @@ associative, since $I*(J*K) \ne (I*J)*K$.
 \ncarc{->}{e4}{e1}
 \ncarc{->}{e1}{e2}
 \end{pspicture}
+<<Octonion.input>>=
+-- oct.spad.pamphlet Octonion.input
+)spool Octonion.output
+)set message test on
+)set message auto off
+)clear all
+--S 1
+oci1 := octon(1,2,3,4,5,6,7,8)
+--R 
+--R
+--R   (1)  1 + 2i + 3j + 4k + 5E + 6I + 7J + 8K
+--R                                                       Type: Octonion 
Integer
+--E 1
 
+--S 2
+oci2 := octon(7,2,3,-4,5,6,-7,0)
+--R 
+--R
+--R   (2)  7 + 2i + 3j - 4k + 5E + 6I - 7J
+--R                                                       Type: Octonion 
Integer
+--E 2
+
+--S 3
+oci3 := octon(quatern(-7,-12,3,-10), quatern(5,6,9,0))
+--R 
+--R
+--R   (3)  - 7 - 12i + 3j - 10k + 5E + 6I + 9J
+--R                                                       Type: Octonion 
Integer
+--E 3
+
+--S 4
+(oci1 * oci2) * oci3 - oci1 * (oci2 * oci3)
+--R 
+--R
+--R   (4)  2696i - 2928j - 4072k + 16E - 1192I + 832J + 2616K
+--R                                                       Type: Octonion 
Integer
+--E 4
+
+--S 5
+[real oci1, imagi oci1, imagj oci1, imagk oci1, _
+ imagE oci1, imagI oci1, imagJ oci1, imagK oci1]
+--R 
+--R
+--R   (5)  [1,2,3,4,5,6,7,8]
+--R                                                   Type: List 
PositiveInteger
+--E 5
+
+--S 6
+q : Quaternion Polynomial Integer := quatern(q1, qi, qj, qk)
+--R 
+--R
+--R   (6)  q1 + qi i + qj j + qk k
+--R                                          Type: Quaternion Polynomial 
Integer
+--E 6
+
+--S 7
+E : Octonion Polynomial Integer:= octon(0,0,0,0,1,0,0,0)
+--R 
+--R
+--R   (7)  E
+--R                                            Type: Octonion Polynomial 
Integer
+--E 7
+
+--S 8
+q * E
+--R 
+--R
+--R   (8)  q1 E + qi I + qj J + qk K
+--R                                            Type: Octonion Polynomial 
Integer
+--E 8
+
+--S 9
+E * q
+--R 
+--R
+--R   (9)  q1 E - qi I - qj J - qk K
+--R                                            Type: Octonion Polynomial 
Integer
+--E 9
+
+--S 10
+q * 1$(Octonion Polynomial Integer)
+--R 
+--R
+--R   (10)  q1 + qi i + qj j + qk k
+--R                                            Type: Octonion Polynomial 
Integer
+--E 10
+
+--S 11
+1$(Octonion Polynomial Integer) * q
+--R 
+--R
+--R   (11)  q1 + qi i + qj j + qk k
+--R                                            Type: Octonion Polynomial 
Integer
+--E 11
+
+--S 12
+o : Octonion Polynomial Integer := octon(o1, oi, oj, ok, oE, oI, oJ, oK)
+--R 
+--R
+--R   (12)  o1 + oi i + oj j + ok k + oE E + oI I + oJ J + oK K
+--R                                            Type: Octonion Polynomial 
Integer
+--E 12
+
+--S 13
+norm o
+--R 
+--R
+--R           2     2     2     2     2     2     2     2
+--R   (13)  ok  + oj  + oi  + oK  + oJ  + oI  + oE  + o1
+--R                                                     Type: Polynomial 
Integer
+--E 13
+
+--S 14
+p : Octonion Polynomial Integer := octon(p1, pi, pj, pk, pE, pI, pJ, pK)
+--R 
+--R
+--R   (14)  p1 + pi i + pj j + pk k + pE E + pI I + pJ J + pK K
+--R                                            Type: Octonion Polynomial 
Integer
+--E 14
+
+--S 15
+norm(o*p)-norm(p)*norm(o)
+--R 
+--R
+--R   (15)  0
+--R                                                     Type: Polynomial 
Integer
+--E 15
+)spool
+)lisp (bye)
+@
+<<Octonion.help>>=
+====================================================================
+Octonion examples
+====================================================================
+
+The Octonions, also called the Cayley-Dixon algebra, defined over a
+commutative ring are an eight-dimensional non-associative algebra.
+Their construction from quaternions is similar to the construction
+of quaternions from complex numbers.
+
+As Octonion creates an eight-dimensional algebra, you have to give
+eight components to construct an octonion.
+
+  oci1 := octon(1,2,3,4,5,6,7,8)
+    1 + 2i + 3j + 4k + 5E + 6I + 7J + 8K
+                              Type: Octonion Integer
+
+  oci2 := octon(7,2,3,-4,5,6,-7,0)
+    7 + 2i + 3j - 4k + 5E + 6I - 7J
+                              Type: Octonion Integer
+
+Or you can use two quaternions to create an octonion.
+
+  oci3 := octon(quatern(-7,-12,3,-10), quatern(5,6,9,0))
+    - 7 - 12i + 3j - 10k + 5E + 6I + 9J
+                              Type: Octonion Integer
+
+You can easily demonstrate the non-associativity of multiplication.
+
+  (oci1 * oci2) * oci3 - oci1 * (oci2 * oci3)
+    2696i - 2928j - 4072k + 16E - 1192I + 832J + 2616K
+                              Type: Octonion Integer
+
+As with the quaternions, we have a real part, the imaginary parts 
+i, j, k, and four additional imaginary parts E, I, J and K. These 
+parts correspond to the canonical basis (1,i,j,k,E,I,J,K).
+
+For each basis element there is a component operation to extract the
+coefficient of the basis element for a given octonion.
+
+  [real oci1, imagi oci1, imagj oci1, imagk oci1, _
+   imagE oci1, imagI oci1, imagJ oci1, imagK oci1]
+    [1,2,3,4,5,6,7,8]
+                              Type: List PositiveInteger
+
+A basis with respect to the quaternions is given by (1,E).  However,
+you might ask, what then are the commuting rules?  To answer this, we
+create some generic elements.
+
+We do this in Axiom by simply changing the ground ring from Integer to
+Polynomial Integer.
+
+  q : Quaternion Polynomial Integer := quatern(q1, qi, qj, qk)
+    q1 + qi i + qj j + qk k
+                             Type: Quaternion Polynomial Integer
+
+  E : Octonion Polynomial Integer:= octon(0,0,0,0,1,0,0,0)
+    E
+                             Type: Octonion Polynomial Integer
+
+Note that quaternions are automatically converted to octonions in the
+obvious way.
+
+  q * E
+    q1 E + qi I + qj J + qk K
+                             Type: Octonion Polynomial Integer
+
+  E * q
+    q1 E - qi I - qj J - qk K
+                             Type: Octonion Polynomial Integer
+
+  q * 1$(Octonion Polynomial Integer)
+    q1 + qi i + qj j + qk k
+                             Type: Octonion Polynomial Integer
+
+  1$(Octonion Polynomial Integer) * q
+    q1 + qi i + qj j + qk k
+                             Type: Octonion Polynomial Integer
+
+Finally, we check that the norm, defined as the sum of the squares of
+the coefficients, is a multiplicative map.
+
+  o : Octonion Polynomial Integer := octon(o1, oi, oj, ok, oE, oI, oJ, oK)
+    o1 + oi i + oj j + ok k + oE E + oI I + oJ J + oK K
+                             Type: Octonion Polynomial Integer
+
+  norm o
+      2     2     2     2     2     2     2     2
+    ok  + oj  + oi  + oK  + oJ  + oI  + oE  + o1
+                             Type: Polynomial Integer
+
+  p : Octonion Polynomial Integer := octon(p1, pi, pj, pk, pE, pI, pJ, pK)
+    p1 + pi i + pj j + pk k + pE E + pI I + pJ J + pK K
+                             Type: Octonion Polynomial Integer
+
+Since the result is 0, the norm is multiplicative.
+
+  norm(o*p)-norm(p)*norm(o)
+    0
+                             Type: Polynomial Integer
+
+See Also:
+o )help Quaternion
+o )show Octonion
+o $AXIOM/doc/src/algebra/oct.spad.dvi
+
+@
 <<domain OCT Octonion>>=
 )abbrev domain OCT Octonion
 ++ Author: R. Wisbauer, J. Grabmeier
diff --git a/src/algebra/perm.spad.pamphlet b/src/algebra/perm.spad.pamphlet
index 537ca1c..481ba70 100644
--- a/src/algebra/perm.spad.pamphlet
+++ b/src/algebra/perm.spad.pamphlet
@@ -176,6 +176,119 @@ points easily.
 Note that this was not respected in versions before [[patch--50]] of this
 domain.
 
+<<Permutation.input>>=
+-- perm.spad.pamphlet Permutation.input
+)spool Permutation.output
+)set message test on
+)set message auto off
+)clear all
+--S 1 of 8
+p := coercePreimagesImages([[1,2,3],[1,2,3]])
+--R 
+--R
+--R   (1)  1
+--R                                            Type: Permutation 
PositiveInteger
+--E 1
+
+--S 2 of 8
+movedPoints p    -- should return {}
+--R 
+--R
+--R   (2)  {}
+--R                                                    Type: Set 
PositiveInteger
+--E 2
+
+--S 3 of 8
+even? p          -- should return true
+--R 
+--R
+--R   (3)  true
+--R                                                                Type: 
Boolean
+--E 3
+
+--S 4 of 8
+p := coercePreimagesImages([[0,1,2,3],[3,0,2,1]])$PERM ZMOD 4
+--R 
+--R
+--R   (4)  (1 0 3)
+--R                                               Type: Permutation IntegerMod 
4
+--E 4
+
+--S 5 of 8
+fixedPoints p    -- should return {2}
+--R 
+--R
+--R   (5)  {2}
+--R                                                       Type: Set IntegerMod 
4
+--E 5
+
+--S 6 of 8
+q := coercePreimagesImages([[0,1,2,3],[1,0]])$PERM ZMOD 4
+--R 
+--R
+--R   (6)  (1 0)
+--R                                               Type: Permutation IntegerMod 
4
+--E 6
+
+--S 7 of 8
+fixedPoints(p*q) -- should return {2,0}
+--R 
+--R
+--R   (7)  {2,0}
+--R                                                       Type: Set IntegerMod 
4
+--E 7
+
+--S 8 of 8
+even?(p*q)       -- should return false
+--R 
+--R
+--R   (8)  false
+--R                                                                Type: 
Boolean
+--E 8
+)spool
+)lisp (bye)
+@
+<<Permutation.help>>=
+====================================================================
+Permutation Examples
+====================================================================
+
+  p := coercePreimagesImages([[1,2,3],[1,2,3]])
+    1
+                      Type: Permutation PositiveInteger
+
+  movedPoints p
+    {}
+                      Type: Set PositiveInteger
+
+  even? p
+    true
+                       Type: Boolean
+
+  p := coercePreimagesImages([[0,1,2,3],[3,0,2,1]])$PERM ZMOD 4
+    (1 0 3)
+                       Type: Permutation IntegerMod 4
+
+  fixedPoints p
+    {2}
+                       Type: Set IntegerMod 4
+
+  q := coercePreimagesImages([[0,1,2,3],[1,0]])$PERM ZMOD 4
+    (1 0)
+                       Type: Permutation IntegerMod 4
+
+  fixedPoints(p*q)
+    {2,0}
+                       Type: Set IntegerMod 4
+  even?(p*q)
+    false
+                       Type: Boolean
+
+See Also:
+o )show Permutation
+o $AXIOM/doc/src/algebra/perm.spad.dvi
+
+@
 <<domain PERM Permutation>>=
     -- import of domains and packages
 
@@ -307,17 +420,6 @@ causing bugs when computing [[movedPoints]], 
[[fixedPoints]], [[even?]],
 The other coercion facilities check for fixed points. It also seems that [[*]]
 removes fixed points from its result.
 
-<<TEST PERM>>=
-  p := coercePreimagesImages([[1,2,3],[1,2,3]])
-  movedPoints p    -- should return {}
-  even? p          -- should return true
-  p := coercePreimagesImages([[0,1,2,3],[3,0,2,1]])$PERM ZMOD 4
-  fixedPoints p    -- should return {2}
-  q := coercePreimagesImages([[0,1,2,3],[1,0]])$PERM ZMOD 4
-  fixedPoints(p*q) -- should return {2,0}
-  even?(p*q)       -- should return false
-@
- 
 <<domain PERM Permutation>>=
 
     movedPoints p == construct p.1
diff --git a/src/algebra/radix.spad.pamphlet b/src/algebra/radix.spad.pamphlet
index 4c25fd0..3e536be 100644
--- a/src/algebra/radix.spad.pamphlet
+++ b/src/algebra/radix.spad.pamphlet
@@ -713,8 +713,9 @@ g := gcd(p, q)
 )lisp (bye)
 @
 <<HexadecimalExpansion.help>>=
-\section{HexadecimalExpansion}
-\label{HexadecimalExpansionXmpPage}
+====================================================================
+HexadecimalExpansion
+====================================================================
 
 All rationals have repeating hexadecimal expansions.  The operation
 hex returns these expansions of type HexadecimalExpansion.  Operations
diff --git a/src/algebra/view2d.spad.pamphlet b/src/algebra/view2d.spad.pamphlet
index 2d77e98..8b27df5 100644
--- a/src/algebra/view2d.spad.pamphlet
+++ b/src/algebra/view2d.spad.pamphlet
@@ -417,64 +417,246 @@ GraphImage (): Exports == Implementation where
 
 @
 \section{domain VIEW2D TwoDimensionalViewport}
-\subsection{Creating multiple graphs in a Viewport}
-We want to graph $x^3 * (a+b*x)$ on the interval $x=-1\ldots1$
+<<TwoDimensionalViewport.help>>=
+====================================================================
+TwoDimensionalViewport examples
+====================================================================
+
+We want to graph x^3 * (a+b*x) on the interval x=-1..1
 so we clear out the workspace
-<<multigraph.input>>=
-)clear all
-@
+
 We assign values to the constants
-<<multigraph.input>>=
-a:=0.5
-b:=0.5
-@
+  a:=0.5
+    0.5
+                              Type: Float
+  b:=0.5
+    0.5
+                              Type: Float
+
 We draw the first case of the graph
-<<multigraph.input>>=
-y1:=draw(x^3*(a+b*x),x=-1..1,title=="2.2.10 explicit")
-@
+
+  y1:=draw(x^3*(a+b*x),x=-1..1,title=="2.2.10 explicit")
+    TwoDimensionalViewport: "2.2.10 explicit"
+                              Type: TwoDimensionalViewport
+
 We fetch the graph of the first object
-<<multigraph.input>>=
-g1:=getGraph(y1,1)
-@
+
+  g1:=getGraph(y1,1)
+    Graph with 1 point list
+                              Type: GraphImage
+
 We extract its points
-<<multigraph.input>>=
-pointLists g1
-@
+
+  pointLists g1
+   [
+     [[-1.,0.,1.,3.], [-0.95833333333333337,-1.8336166570216028E-2,1.,3.],
+      [-0.91666666666666674,-3.2093942901234518E-2,1.,3.],
+      [-0.87500000000000011,-4.18701171875E-2,1.,3.],
+      [-0.83333333333333348,-4.8225308641975301E-2,1.,3.],
+      [-0.79166666666666685,-5.1683967496141986E-2,1.,3.],
+      [-0.75000000000000022,-5.2734375E-2,1.,3.],
+      [-0.70833333333333359,-5.1828643422067916E-2,1.,3.],
+      [-0.66666666666666696,-4.9382716049382741E-2,1.,3.],
+      [-0.62500000000000033,-4.5776367187500042E-2,1.,3.],
+      [-0.5833333333333337,-4.1353202160493867E-2,1.,3.],
+      [-0.54166666666666707,-3.6420657310956832E-2,1.,3.],
+      [-0.50000000000000044,-3.1250000000000056E-2,1.,3.],
+      [-0.45833333333333376,-2.6076328607253136E-2,1.,3.],
+      [-0.41666666666666707,-2.1098572530864244E-2,1.,3.],
+      [-0.37500000000000039,-1.6479492187500042E-2,1.,3.],
+      [-0.3333333333333337,-1.2345679012345713E-2,1.,3.],
+      [-0.29166666666666702,-8.7875554591049648E-3,1.,3.],
+      [-0.25000000000000033,-5.8593750000000208E-3,1.,3.],
+      [-0.20833333333333368,-3.5792221257716214E-3,1.,3.],
+      [-0.16666666666666702,-1.9290123456790237E-3,1.,3.],
+      [-0.12500000000000036,-8.5449218750000705E-4,1.,3.],
+      [-8.3333333333333703E-2,-2.6523919753086765E-4,1.,3.],
+      [-4.1666666666667039E-2,-3.4661940586420673E-5,1.,3.],
+      [-3.7470027081099033E-16,-2.6304013894372334E-47,1.,3.],
+      [4.166666666666629E-2,3.7676022376542178E-5,1.,3.],
+      [8.3333333333332954E-2,3.1346450617283515E-4,1.,3.],
+      [0.12499999999999961,1.0986328124999894E-3,1.,3.],
+      [0.16666666666666627,2.7006172839505972E-3,1.,3.],
+      [0.20833333333333293,5.463023244598731E-3,1.,3.],
+      [0.24999999999999958,9.765624999999948E-3,1.,3.],
+      [0.29166666666666624,1.6024365837191284E-2,1.,3.],
+      [0.33333333333333293,2.469135802469126E-2,1.,3.],
+      [0.37499999999999961,3.6254882812499882E-2,1.,3.],
+      [0.4166666666666663,5.1239390432098617E-2,1.,3.],
+      [0.45833333333333298,7.0205500096450435E-2,1.,3.],
+      [0.49999999999999967,9.3749999999999792E-2,1.,3.],
+      [0.5416666666666663,0.12250584731867258,1.,3.],
+      [0.58333333333333293,0.15714216820987617,1.,3.],
+      [0.62499999999999956,0.1983642578124995,1.,3.],
+      [0.66666666666666619,0.24691358024691298,1.,3.],
+      [0.70833333333333282,0.30356776861496837,1.,3.],
+      [0.74999999999999944,0.369140624999999,1.,3.],
+      [0.79166666666666607,0.44448212046681984,1.,3.],
+      [0.8333333333333327,0.530478395061727,1.,3.],
+      [0.87499999999999933,0.62805175781249845,1.,3.],
+      [0.91666666666666596,0.73816068672839308,1.,3.],
+      [0.95833333333333259,0.86179982880015205,1.,3.], [1.,1.,1.,3.]]
+     ]
+                        Type: List List Point DoubleFloat
 
 Now we create a second graph with a changed parameter
-<<multigraph.input>>=
-b:=1.0
-@
+
+  b:=1.0
+    1.0
+                        Type: Float
+
 We draw it
-<<multigraph.input>>=
-y2:=draw(x^3*(a+b*x),x=-1..1)
-@
+
+  y2:=draw(x^3*(a+b*x),x=-1..1)
+    TwoDimensionalViewport: "AXIOM2D"
+                        Type: TwoDimensionalViewport
+
 We fetch this new graph
-<<multigraph.input>>=
-g2:=getGraph(y2,1)
-@
+
+  g2:=getGraph(y2,1)
+    Graph with 1 point list
+                       Type: GraphImage
+
 We get the points from this graph
-<<multigraph.input>>=
-pointLists g2
-@
-and we put these points, $g2$ onto the first graph $y1$ as graph $2$
-<<multigraph.input>>=
-putGraph(y1,g2,2)
-@
+
+  pointLists g2
+   [
+     [[-1.,0.5,1.,3.], [-0.95833333333333337,0.40339566454475323,1.,3.],
+      [-0.91666666666666674,0.32093942901234584,1.,3.],
+      [-0.87500000000000011,0.25122070312500017,1.,3.],
+      [-0.83333333333333348,0.19290123456790137,1.,3.],
+      [-0.79166666666666685,0.14471510898919768,1.,3.],
+      [-0.75000000000000022,0.10546875000000019,1.,3.],
+      [-0.70833333333333359,7.404091917438288E-2,1.,3.],
+      [-0.66666666666666696,4.938271604938288E-2,1.,3.],
+      [-0.62500000000000033,3.0517578125000125E-2,1.,3.],
+      [-0.5833333333333337,1.6541280864197649E-2,1.,3.],
+      [-0.54166666666666707,6.6219376929013279E-3,1.,3.],
+      [-0.50000000000000044,5.5511151231257827E-17,1.,3.],
+      [-0.45833333333333376,-4.011742862654287E-3,1.,3.],
+      [-0.41666666666666707,-6.0281635802469057E-3,1.,3.],
+      [-0.37500000000000039,-6.5917968750000035E-3,1.,3.],
+      [-0.3333333333333337,-6.1728395061728461E-3,1.,3.],
+      [-0.29166666666666702,-5.1691502700617377E-3,1.,3.],
+      [-0.25000000000000033,-3.9062500000000104E-3,1.,3.],
+      [-0.20833333333333368,-2.6373215663580349E-3,1.,3.],
+      [-0.16666666666666702,-1.543209876543218E-3,1.,3.],
+      [-0.12500000000000036,-7.3242187500000564E-4,1.,3.],
+      [-8.3333333333333703E-2,-2.4112654320987957E-4,1.,3.],
+      [-4.1666666666667039E-2,-3.315489969135889E-5,1.,3.],
+      [-3.7470027081099033E-16,-2.6304013894372324E-47,1.,3.],
+      [4.166666666666629E-2,3.9183063271603852E-5,1.,3.],
+      [8.3333333333332954E-2,3.3757716049382237E-4,1.,3.],
+      [0.12499999999999961,1.2207031249999879E-3,1.,3.],
+      [0.16666666666666627,3.0864197530863957E-3,1.,3.],
+      [0.20833333333333293,6.4049238040123045E-3,1.,3.],
+      [0.24999999999999958,1.1718749999999934E-2,1.,3.],
+      [0.29166666666666624,1.9642771026234473E-2,1.,3.],
+      [0.33333333333333293,3.0864197530864071E-2,1.,3.],
+      [0.37499999999999961,4.6142578124999847E-2,1.,3.],
+      [0.4166666666666663,6.6309799382715848E-2,1.,3.],
+      [0.45833333333333298,9.2270085841049135E-2,1.,3.],
+      [0.49999999999999967,0.12499999999999971,1.,3.],
+      [0.5416666666666663,0.16554844232253049,1.,3.],
+      [0.58333333333333293,0.21503665123456736,1.,3.],
+      [0.62499999999999956,0.27465820312499928,1.,3.],
+      [0.66666666666666619,0.3456790123456781,1.,3.],
+      [0.70833333333333282,0.42943733121141858,1.,3.],
+      [0.74999999999999944,0.52734374999999845,1.,3.],
+      [0.79166666666666607,0.64088119695215873,1.,3.],
+      [0.8333333333333327,0.77160493827160281,1.,3.],
+      [0.87499999999999933,0.92114257812499756,1.,3.],
+      [0.91666666666666596,1.0911940586419722,1.,3.],
+      [0.95833333333333259,1.2835316599151199,1.,3.], [1.,1.5,1.,3.]]
+     ]
+                           Type: List List Point DoubleFloat
+
+and we put these points, g2 onto the first graph y1 as graph 2
+
+  putGraph(y1,g2,2)
+                           Type: Void
+
 And now we do the whole sequence again
-<<multigraph.input>>=
-b:=2.0
-y3:=draw(x^3*(a+b*x),x=-1..1)
-g3:=getGraph(y3,1)
-pointLists g3
-@
-and put the third graphs points $g3$ onto the first graph $y1$ as graph $3$
-<<multigraph.input>>=
-putGraph(y1,g3,3)
-@
+
+  b:=2.0
+    2.0
+                           Type: Float
+
+  y3:=draw(x^3*(a+b*x),x=-1..1)
+    TwoDimensionalViewport: "AXIOM2D"
+                          Type: TwoDimensionalViewport
+
+  g3:=getGraph(y3,1)
+    Graph with 1 point list
+                          Type: GraphImage
+
+  pointLists g3
+   [
+     [[-1.,1.5,1.,3.], [-0.95833333333333337,1.2468593267746917,1.,3.],
+      [-0.91666666666666674,1.0270061728395066,1.,3.],
+      [-0.87500000000000011,0.83740234375000044,1.,3.],
+      [-0.83333333333333348,0.67515432098765471,1.,3.],
+      [-0.79166666666666685,0.53751326195987703,1.,3.],
+      [-0.75000000000000022,0.42187500000000056,1.,3.],
+      [-0.70833333333333359,0.32578004436728447,1.,3.],
+      [-0.66666666666666696,0.24691358024691412,1.,3.],
+      [-0.62500000000000033,0.18310546875000044,1.,3.],
+      [-0.5833333333333337,0.1323302469135807,1.,3.],
+      [-0.54166666666666707,9.2707127700617648E-2,1.,3.],
+      [-0.50000000000000044,6.2500000000000278E-2,1.,3.],
+      [-0.45833333333333376,4.0117428626543411E-2,1.,3.],
+      [-0.41666666666666707,2.4112654320987775E-2,1.,3.],
+      [-0.37500000000000039,1.3183593750000073E-2,1.,3.],
+      [-0.3333333333333337,6.1728395061728877E-3,1.,3.],
+      [-0.29166666666666702,2.0676601080247183E-3,1.,3.],
+      [-0.25000000000000033,1.0408340855860843E-17,1.,3.],
+      [-0.20833333333333368,-7.5352044753086191E-4,1.,3.],
+      [-0.16666666666666702,-7.7160493827160663E-4,1.,3.],
+      [-0.12500000000000036,-4.8828125000000282E-4,1.,3.],
+      [-8.3333333333333703E-2,-1.9290123456790339E-4,1.,3.],
+      [-4.1666666666667039E-2,-3.0140817901235325E-5,1.,3.],
+      [-3.7470027081099033E-16,-2.6304013894372305E-47,1.,3.],
+      [4.166666666666629E-2,4.21971450617272E-5,1.,3.],
+      [8.3333333333332954E-2,3.8580246913579681E-4,1.,3.],
+      [0.12499999999999961,1.4648437499999848E-3,1.,3.],
+      [0.16666666666666627,3.8580246913579933E-3,1.,3.],
+      [0.20833333333333293,8.2887249228394497E-3,1.,3.],
+      [0.24999999999999958,1.562499999999991E-2,1.,3.],
+      [0.29166666666666624,2.6879581404320851E-2,1.,3.],
+      [0.33333333333333293,4.3209876543209694E-2,1.,3.],
+      [0.37499999999999961,6.5917968749999764E-2,1.,3.],
+      [0.4166666666666663,9.6450617283950296E-2,1.,3.],
+      [0.45833333333333298,0.13639925733024652,1.,3.],
+      [0.49999999999999967,0.18749999999999956,1.,3.],
+      [0.5416666666666663,0.25163363233024633,1.,3.],
+      [0.58333333333333293,0.33082561728394977,1.,3.],
+      [0.62499999999999956,0.42724609374999883,1.,3.],
+      [0.66666666666666619,0.5432098765432084,1.,3.],
+      [0.70833333333333282,0.68117645640431912,1.,3.],
+      [0.74999999999999944,0.84374999999999756,1.,3.],
+      [0.79166666666666607,1.0336793499228365,1.,3.],
+      [0.8333333333333327,1.2538580246913544,1.,3.],
+      [0.87499999999999933,1.507324218749996,1.,3.],
+      [0.91666666666666596,1.7972608024691306,1.,3.],
+      [0.95833333333333259,2.1269953221450555,1.,3.], [1.,2.5,1.,3.]]
+     ]
+                        Type: List List Point DoubleFloat
+
+and put the third graphs points g3 onto the first graph y1 as graph 3
+
+  putGraph(y1,g3,3)
+                        Type: Void
+
 Finally we show the combined result
-<<multigraph.input>>=
-vp:=makeViewport2D(y1)
+
+  vp:=makeViewport2D(y1)
+    TwoDimensionalViewport: "2.2.10 explicit"
+                        Type: TwoDimensionalViewport
+
+See Also:
+o )show TwoDimensionalViewport
+o $AXIOM/doc/src/algebra/view2d.spad.dvi
+
 @
 <<domain VIEW2D TwoDimensionalViewport>>=
 )abbrev domain VIEW2D TwoDimensionalViewport
diff --git a/src/algebra/xlpoly.spad.pamphlet b/src/algebra/xlpoly.spad.pamphlet
index 34c26e1..8faf7cb 100644
--- a/src/algebra/xlpoly.spad.pamphlet
+++ b/src/algebra/xlpoly.spad.pamphlet
@@ -10,6 +10,304 @@
 \tableofcontents
 \eject
 \section{domain MAGMA Magma}
+<<Magma.input>>=
+-- xlpoly.spad.pamphlet Magma.input
+)spool Magma.output
+)set message test on
+)set message auto off
+)clear all
+--S 1
+x:Symbol :='x
+--R 
+--R
+--R   (1)  x
+--R                                                                 Type: 
Symbol
+--E 1
+
+--S 2
+y:Symbol :='y
+--R 
+--R
+--R   (2)  y
+--R                                                                 Type: 
Symbol
+--E 2
+
+--S 3
+z:Symbol :='z
+--R 
+--R
+--R   (3)  z
+--R                                                                 Type: 
Symbol
+--E 3
+
+--S 4
+word := OrderedFreeMonoid(Symbol)
+--R 
+--R
+--R   (4)  OrderedFreeMonoid Symbol
+--R                                                                 Type: 
Domain
+--E 4
+
+--S 5
+tree := Magma(Symbol)
+--R 
+--R
+--R   (5)  Magma Symbol
+--R                                                                 Type: 
Domain
+--E 5
+
+--S 6
+a:tree := x*x 
+--R 
+--R
+--R   (6)  [x,x]
+--R                                                           Type: Magma 
Symbol
+--E 6
+
+--S 7
+b:tree := y*y
+--R 
+--R
+--R   (7)  [y,y]
+--R                                                           Type: Magma 
Symbol
+--E 7
+
+--S 8
+c:tree := a*b
+--R 
+--R
+--R   (8)  [[x,x],[y,y]]
+--R                                                           Type: Magma 
Symbol
+--E 8
+
+--S 9
+left c
+--R 
+--R
+--R   (9)  [x,x]
+--R                                                           Type: Magma 
Symbol
+--E 9
+
+--S 10
+right c
+--R 
+--R
+--R   (10)  [y,y]
+--R                                                           Type: Magma 
Symbol
+--E 10
+
+--S 11
+length c
+--R 
+--R
+--R   (11)  4
+--R                                                        Type: 
PositiveInteger
+--E 11
+
+--S 12
+c::word
+--R 
+--R
+--R          2 2
+--R   (12)  x y
+--R                                               Type: OrderedFreeMonoid 
Symbol
+--E 12
+
+--S 13
+a < b
+--R 
+--R
+--R   (13)  true
+--R                                                                Type: 
Boolean
+--E 13
+
+--S 14
+a < c
+--R 
+--R
+--R   (14)  true
+--R                                                                Type: 
Boolean
+--E 14
+
+--S 15
+b < c
+--R 
+--R
+--R   (15)  true
+--R                                                                Type: 
Boolean
+--E 15
+
+--S 16
+first c
+--R 
+--R
+--R   (16)  x
+--R                                                                 Type: 
Symbol
+--E 16
+
+--S 17
+rest c
+--R 
+--R
+--R   (17)  [x,[y,y]]
+--R                                                           Type: Magma 
Symbol
+--E 17
+
+--S 18
+rest rest c
+--R 
+--R
+--R   (18)  [y,y]
+--R                                                           Type: Magma 
Symbol
+--E 18
+
+--S 19
+ax:tree := a*x
+--R 
+--R
+--R   (19)  [[x,x],x]
+--R                                                           Type: Magma 
Symbol
+--E 19
+
+--S 20
+xa:tree := x*a
+--R 
+--R
+--R   (20)  [x,[x,x]]
+--R                                                           Type: Magma 
Symbol
+--E 20
+
+--S 21
+xa < ax
+--R 
+--R
+--R   (21)  true
+--R                                                                Type: 
Boolean
+--E 21
+
+--S 22
+lexico(xa,ax)
+--R 
+--R
+--R   (22)  false
+--R                                                                Type: 
Boolean
+--E 22
+)spool
+)lisp (bye)
+@
+<<Magma.help>>=
+====================================================================
+Magma examples
+====================================================================
+
+Initialisations
+
+  x:Symbol :='x
+    x
+                         Type: Symbol
+
+  y:Symbol :='y
+    y
+                         Type: Symbol
+
+  z:Symbol :='z
+    z
+                         Type: Symbol
+
+  word := OrderedFreeMonoid(Symbol)
+    OrderedFreeMonoid Symbol
+                         Type: Domain
+
+  tree := Magma(Symbol)
+    Magma Symbol
+                         Type: Domain
+
+Let's make some trees
+
+  a:tree := x*x 
+    [x,x]
+                         Type: Magma Symbol
+
+  b:tree := y*y
+    [y,y]
+                         Type: Magma Symbol
+
+  c:tree := a*b
+    [[x,x],[y,y]]
+                         Type: Magma Symbol
+
+Query the trees
+
+  left c
+    [x,x]
+                         Type: Magma Symbol
+
+  right c
+    [y,y]
+                         Type: Magma Symbol
+
+  length c
+    4
+                         Type: PositiveInteger
+
+Coerce to the monoid
+
+  c::word
+     2 2
+    x y
+                         Type: OrderedFreeMonoid Symbol
+
+Check ordering
+
+  a < b
+    true
+                         Type: Boolean
+
+  a < c
+    true
+                         Type: Boolean
+
+  b < c
+    true
+                         Type: Boolean
+
+Navigate the tree
+
+  first c
+    x
+                         Type: Symbol
+
+  rest c
+    [x,[y,y]]
+                         Type: Magma Symbol
+
+  rest rest c
+    [y,y]
+                         Type: Magma Symbol
+
+Check ordering
+
+  ax:tree := a*x
+    [[x,x],x]
+                         Type: Magma Symbol
+
+  xa:tree := x*a
+    [x,[x,x]]
+                         Type: Magma Symbol
+
+  xa < ax
+    true
+                         Type: Boolean
+
+  lexico(xa,ax)
+    false
+                         Type: Boolean
+
+See Also:
+o )show Magma
+o $AXIOM/doc/src/algebra/xlpoly.spad.dvi
+
+@
 <<domain MAGMA Magma>>=
 )abbrev domain MAGMA Magma
 ++ Author: Michel Petitot (address@hidden).
@@ -153,11 +451,345 @@ Magma(VarSet:OrderedSet):Public == Private where
 
 @
 \section{domain LWORD LyndonWord}
-A function $f \epsilon \lbrace 0,1 \rbrace$ is called acyclic if
-$C(F)$ consists of $n$ different objects. The canonical representative
-of the orbit of an acyclic function is usually called a Lyndon Word \cite{1}.
-If $f$ is acyclic, then all elements in the orbit $C(f)$ are acyclic
-as well, and we call $C(f)$ an acyclic orbit. 
+<<LyndonWord.input>>=
+-- xlpoly.spad.pamphlet LyndonWord.input
+)spool LyndonWord.output
+)set message test on
+)set message auto off
+)clear all
+--S 1 of 22
+a:Symbol :='a
+--R 
+--R
+--R   (1)  a
+--R                                                                 Type: 
Symbol
+--E 1
+
+--S 2 of 22
+b:Symbol :='b
+--R 
+--R
+--R   (2)  b
+--R                                                                 Type: 
Symbol
+--E 2
+
+--S 3 of 22
+c:Symbol :='c
+--R 
+--R
+--R   (3)  c
+--R                                                                 Type: 
Symbol
+--E 3
+
+--S 4 of 22
+lword:= LyndonWord(Symbol)
+--R 
+--R
+--R   (4)  LyndonWord Symbol
+--R                                                                 Type: 
Domain
+--E 4
+
+--S 5 of 22
+magma := Magma(Symbol)
+--R 
+--R
+--R   (5)  Magma Symbol
+--R                                                                 Type: 
Domain
+--E 5
+
+--S 6 of 22
+word := OrderedFreeMonoid(Symbol)
+--R 
+--R
+--R   (6)  OrderedFreeMonoid Symbol
+--R                                                                 Type: 
Domain
+--E 6
+
+--S 7 of 22
+LyndonWordsList1([a,b,c],3)$lword
+--R 
+--R
+--R   (7)
+--R   [[[a],[b],[c]], [[a b],[a c],[b c]],
+--R       2     2       2                      2    2       2
+--R    [[a b],[a c],[a b ],[a b c],[a c b],[a c ],[b c],[b c ]]]
+--R                             Type: OneDimensionalArray List LyndonWord 
Symbol
+--E 7
+
+--S 8 of 22
+LyndonWordsList([a,b,c],3)$lword
+--R 
+--R
+--R   (8)
+--R                                          2      2        2
+--R   [[a], [b], [c], [a b], [a c], [b c], [a b], [a c], [a b ], [a b c], [a c 
b],
+--R        2     2        2
+--R    [a c ], [b c], [b c ]]
+--R                                                 Type: List LyndonWord 
Symbol
+--E 8
+
+--S 9 of 22
+lw := LyndonWordsList([a,b],5)$lword
+--R 
+--R
+--R   (9)
+--R                       2        2     3      2 2       3     4      3 2
+--R   [[a], [b], [a b], [a b], [a b ], [a b], [a b ], [a b ], [a b], [a b ],
+--R      2          2 3           2       4
+--R    [a b a b], [a b ], [a b a b ], [a b ]]
+--R                                                 Type: List LyndonWord 
Symbol
+--E 9
+
+--S 10 of 22
+w1 : word := lw.4 :: word
+--R 
+--R
+--R          2
+--R   (10)  a b
+--R                                               Type: OrderedFreeMonoid 
Symbol
+--E 10
+
+--S 11 of 22
+w2 : word := lw.5 :: word
+--R 
+--R
+--R            2
+--R   (11)  a b
+--R                                               Type: OrderedFreeMonoid 
Symbol
+--E 11
+
+--S 12 of 22
+factor(a::word)$lword
+--R 
+--R
+--R   (12)  [[a]]
+--R                                                 Type: List LyndonWord 
Symbol
+--E 12
+
+--S 13 of 22
+factor(w1*w2)$lword
+--R 
+--R
+--R            2     2
+--R   (13)  [[a b a b ]]
+--R                                                 Type: List LyndonWord 
Symbol
+--E 13
+
+--S 14 of 22
+factor(w2*w2)$lword
+--R 
+--R
+--R              2      2
+--R   (14)  [[a b ],[a b ]]
+--R                                                 Type: List LyndonWord 
Symbol
+--E 14
+
+--S 15 of 22
+factor(w2*w1)$lword
+--R 
+--R
+--R              2    2
+--R   (15)  [[a b ],[a b]]
+--R                                                 Type: List LyndonWord 
Symbol
+--E 15
+
+--S 16 of 22
+lyndon?(w1)$lword
+--R 
+--R
+--R   (16)  true
+--R                                                                Type: 
Boolean
+--E 16
+
+--S 17 of 22
+lyndon?(w1*w2)$lword
+--R 
+--R
+--R   (17)  true
+--R                                                                Type: 
Boolean
+--E 17
+
+--S 18 of 22
+lyndon?(w2*w1)$lword
+--R 
+--R
+--R   (18)  false
+--R                                                                Type: 
Boolean
+--E 18
+
+--S 19 of 22
+lyndonIfCan(w1)$lword
+--R 
+--R
+--R           2
+--R   (19)  [a b]
+--R                                           Type: Union(LyndonWord 
Symbol,...)
+--E 19
+
+--S 20 of 22
+lyndonIfCan(w2*w1)$lword
+--R 
+--R
+--R   (20)  "failed"
+--R                                                    Type: 
Union("failed",...)
+--E 20
+
+--S 21 of 22
+lyndon(w1)$lword
+--R 
+--R
+--R           2
+--R   (21)  [a b]
+--R                                                      Type: LyndonWord 
Symbol
+--E 21
+
+--S 22 of 22
+lyndon(w1*w2)$lword
+--R 
+--R
+--R           2     2
+--R   (22)  [a b a b ]
+--R                                                      Type: LyndonWord 
Symbol
+--E 22
+)spool
+)lisp (bye)
+@
+<<LyndonWord.help>>=
+====================================================================
+LyndonWord examples
+====================================================================
+
+A function f in [0,1] is called acyclic if C(F) consists of n
+different objects. The canonical representative of the orbit of an
+acyclic function is usually called a Lyndon Word. If f is acyclic,
+then all elements in the orbit C(f) are acyclic as well, and we call
+C(f) an acyclic orbit.
+
+====================================================================
+Initialisations
+====================================================================
+
+  a:Symbol :='a
+    a
+                            Type: Symbol
+
+  b:Symbol :='b
+    b
+                            Type: Symbol
+
+  c:Symbol :='c
+    c
+                            Type: Symbol
+
+  lword:= LyndonWord(Symbol)
+    LyndonWord Symbol
+                            Type: Domain
+
+  magma := Magma(Symbol)
+    Magma Symbol
+                            Type: Domain
+
+  word := OrderedFreeMonoid(Symbol)
+    OrderedFreeMonoid Symbol
+                            Type: Domain
+
+All Lyndon words of with a, b, c to order 3
+
+  LyndonWordsList1([a,b,c],3)$lword
+   [[[a],[b],[c]], [[a b],[a c],[b c]],
+       2     2       2                      2    2       2
+    [[a b],[a c],[a b ],[a b c],[a c b],[a c ],[b c],[b c ]]]
+                            Type: OneDimensionalArray List LyndonWord Symbol
+
+All Lyndon words of with a, b, c to order 3 in flat list
+
+  LyndonWordsList([a,b,c],3)$lword
+                                          2      2        2
+   [[a], [b], [c], [a b], [a c], [b c], [a b], [a c], [a b ], [a b c], [a c b],
+        2     2        2
+    [a c ], [b c], [b c ]]
+                            Type: List LyndonWord Symbol
+
+All Lyndon words of with a, b to order 5
+
+  lw := LyndonWordsList([a,b],5)$lword
+                       2        2     3      2 2       3     4      3 2
+   [[a], [b], [a b], [a b], [a b ], [a b], [a b ], [a b ], [a b], [a b ],
+      2          2 3           2       4
+    [a b a b], [a b ], [a b a b ], [a b ]]
+                            Type: List LyndonWord Symbol
+
+  w1 : word := lw.4 :: word
+     2
+    a b
+                             Type: OrderedFreeMonoid Symbol
+
+  w2 : word := lw.5 :: word
+       2
+    a b
+                             Type: OrderedFreeMonoid Symbol
+
+Let's try factoring
+
+  factor(a::word)$lword
+    [[a]]
+                             Type: List LyndonWord Symbol
+
+  factor(w1*w2)$lword
+       2     2
+    [[a b a b ]]
+                             Type: List LyndonWord Symbol
+
+  factor(w2*w2)$lword
+         2      2
+    [[a b ],[a b ]]
+                             Type: List LyndonWord Symbol
+
+  factor(w2*w1)$lword
+         2    2
+    [[a b ],[a b]]
+                             Type: List LyndonWord Symbol
+
+====================================================================
+Checks and coercions
+====================================================================
+
+  lyndon?(w1)$lword
+    true
+                             Type: Boolean
+
+  lyndon?(w1*w2)$lword
+    true
+                             Type: Boolean
+
+  lyndon?(w2*w1)$lword
+    false
+                             Type: Boolean
+
+  lyndonIfCan(w1)$lword
+      2
+    [a b]
+                             Type: Union(LyndonWord Symbol,...)
+
+  lyndonIfCan(w2*w1)$lword
+    "failed"
+                             Type: Union("failed",...)
+
+  lyndon(w1)$lword
+      2
+    [a b]
+                             Type: LyndonWord Symbol
+
+  lyndon(w1*w2)$lword
+      2     2
+    [a b a b ]
+                             Type: LyndonWord Symbol
+
+See Also:
+o )show LyndonWord
+o $AXIOM/doc/src/algebra/xlpoly.spad.dvi
+
+@
 <<domain LWORD LyndonWord>>=
 )abbrev domain LWORD LyndonWord
 ++ Author: Michel Petitot (address@hidden).
diff --git a/src/doc/book.pamphlet b/src/doc/book.pamphlet
index b941c08..a113b73 100644
--- a/src/doc/book.pamphlet
+++ b/src/doc/book.pamphlet
@@ -4823,7 +4823,7 @@ $$
 
 A {\it multiset} is a set that keeps track of the number of duplicate
 values. \footnote{Multisets are discussed in Section
-\ref{MultiSetXmpPage} on page~\pageref{MultiSetXmpPage}}
+\ref{MultisetXmpPage} on page~\pageref{MultisetXmpPage}}
 
 For all the primes $p$ between 2 and 1000, find the
 distribution of $p \bmod 5$.
@@ -41669,8 +41669,8 @@ For more information on related topics, see
 and
 \ref{TwoDimensionalArrayXmpPage} on page~\pageref{TwoDimensionalArrayXmpPage}.
 
-\section{MultiSet}
-\label{MultiSetXmpPage}
+\section{Multiset}
+\label{MultisetXmpPage}
 
 The domain {\tt Multiset(R)} is similar to {\tt Set(R)} except that
 multiplicities (counts of duplications) are maintained and displayed.
@@ -62605,7 +62605,7 @@ $\hbox{{\rm op}}_{j}$ & is an operation exported by the 
category.
 %
 \condata{MDAGG}{MultiDictionary}{DictionaryOperations}{duplicates insert! 
removeDuplicates!}
 %
-\condata{MSAGG}{MultiSetAggregate}{MultiDictionary SetAggregate}{}
+\condata{MSAGG}{MultisetAggregate}{MultiDictionary SetAggregate}{}
 %
 \condata{MTSCAT}{MultivariateTaylorSeriesCategory}{Evalable InnerEvalable 
PartialDifferentialRing PowerSeriesCategory
    RadicalCategory TranscendentalFunctionCategory}{coefficient extend 
integrate monomial order polynomial}
@@ -62638,7 +62638,7 @@ $\hbox{{\rm op}}_{j}$ & is an operation exported by the 
category.
 %
 \condata{ORDMON}{OrderedMonoid}{Monoid OrderedSet}{}
 %
-\condata{OMAGG}{OrderedMultiSetAggregate}{MultiSetAggregate 
PriorityQueueAggregate}{min}
+\condata{OMAGG}{OrderedMultisetAggregate}{MultisetAggregate 
PriorityQueueAggregate}{min}
 %
 \condata{ORDRING}{OrderedRing}{OrderedAbelianGroup OrderedMonoid Ring}{abs 
negative? positive? sign}
 %
@@ -63514,7 +63514,7 @@ $\hbox{{\rm op}}_{j}$ & is an operation exported by the 
domain.
    leadingMonomial lookup map monomial monomial? monomials numberOfMonomials 
one? random recip reductum retract
    retractIfCan size terms zero?}
 %
-\condata{MSET}{Multiset}{MultiSetAggregate}{{\tt \#} {\tt <} {\tt =} any? bag 
brace coerce construct convert copy count
+\condata{MSET}{Multiset}{MultisetAggregate}{{\tt \#} {\tt <} {\tt =} any? bag 
brace coerce construct convert copy count
    dictionary difference duplicates empty empty? eq? every? extract! find 
insert! inspect intersect less? map map! member?
    members more? multiset parts reduce remove remove! removeDuplicates 
removeDuplicates! select select! size? subset?
    symmetricDifference union}
diff --git a/src/doc/bookvol4.pamphlet b/src/doc/bookvol4.pamphlet
index db4c45d..4173cf1 100644
--- a/src/doc/bookvol4.pamphlet
+++ b/src/doc/bookvol4.pamphlet
@@ -513,9 +513,9 @@ this function.
 
 The libcheck function requires an absolute pathname to the int directory
 so call it thus:
-
-$-->$ )lisp (libcheck "/axiom/int/algebra")
-
+\begin{verbatim}
+ --> )lisp (libcheck "/axiom/int/algebra")
+\end{verbatim}
 The main reason this function is broken is that the system now gets
 exposure information from src/algebra/exposed.lsp.pamphlet. It appears
 that interp.exposed.pamphlet is no longer used (although I made sure
@@ -542,6 +542,7 @@ asq -so FOOBAR
 \end{verbatim}
 and it will tell you the name of the algebra source file that
 defines FOOBAR.
+
 \section{Axiom internal representations}
 \begin{verbatim}
 PRIMITIVE REPRESENTATIONS OF AXIOM OBJECTS
@@ -665,12 +666,110 @@ as the internal representation of
 
 what could be easier?
 \end{verbatim}
+
 \section{axiom command}
 The axiom command will eventually be a shell script. At the moment
 it is just a copy of the interpsys image. However the whole Axiom
 system consists of several processes and the axiom command starts
 these processes. The shell script will transparently replace the
 axiom executable image which will be renamed to spadsys.
+
+\section{help command documentation}
+Axiom supports a )help command that takes a single argument.
+This argument is interpreted as the name of a flat ascii file
+which should live in \$AXIOM/doc/src/spadhelp.
+
+\subsection{help documentation for algebra}
+The help documentation for algebra files lives within the algebra
+pamphlet. The help chunk contains the name of the domain, thus:
+
+\begin{verbatim}
+<<thisdomain.help>>=
+====================================================================
+thisdomain examples
+====================================================================
+
+   (documentation for this domain)
+
+  examplefunction foo
+   output
+                Type: thetype
+
+See Also:
+o )show thisdomain
+o $AXIOM/bin/src/doc/algebra/thisfile.spad.dvi
+
+@
+\end{verbatim}
+
+The documentation starts off with the domain enclosed in two lines
+of equal signs. The documentation is free format. Generally the
+functions are indented two spaces, the output is indented 3 spaces,
+and the Type field has been moved toward the center of the line.
+
+The ``See Also:'' section lists the domain with the ``show'' command
+and the path to the source file in dvi format.
+
+\subsection{adding help documentation in Makefile}
+
+There is a section in the src/algebra/Makefile.pamphlet that reads:
+\begin{verbatim}
+SPADHELP=\
+ ${HELP}/AssociationList.help  ${HELP}/BalancedBinaryTree.help \
+\end{verbatim}
+which is essentially a list of all of the algebra help files. Each item
+in this list refers to a stanza that looks like:
+
+\begin{verbatim}
+${HELP}/AssociationList.help: ${IN}/list.spad.pamphlet
+       @echo 7000 create AssociationList.help from ${IN}/list.spad.pamphlet
+       @${TANGLE} -R"AssociationList.help" ${IN}/list.spad.pamphlet \
+            >${HELP}/AssociationList.help
+       @cp ${HELP}/AssociationList.help ${HELP}/ALIST.help
+       @${TANGLE} -R"AssociationList.input" ${IN}/list.spad.pamphlet \
+            >${INPUT}/AssociationList.input
+\end{verbatim}
+
+Notice that the first line has an connection between the help file and 
+the spad file that contains it. The second line gives debugging output
+containing a unique number. The third line extracts the help file. The
+fourth line copies the file with the long name of the domain to a file
+with the abbreviation of the domain so the user can query the domain
+with either form.
+
+\subsection{Using help documentation for regression testing}
+
+The last line extracts an input test file for the algebra. In general
+each help file is used to create an input test file for regression testing.
+
+There is a Makefile variable called REGRESS in the algebra Makefile:
+\begin{verbatim}
+REGRESS=\
+ AssociationList.regress  BalancedBinaryTree.regress \
+\end{verbatim}
+
+This is part of a Makefile that structure within the algebra Makefile.
+This Makefile gets extracted by the Makefile in the input subdirectory.
+Thus there is a connection between the two Makefiles (algebra and input).
+This algebra regression Makefile goes by the chunk name 
+{\bf algebra.regress}. It contains a list of regression files and a 
+single stanza:
+\begin{verbatim}
+%.regress: %.input
+       @ echo algebra regression testing $*
+       @ rm -f $*.output
+       @ echo ')read $*.input' | ${TESTSYS} 
+       @ echo ')lisp (regress "$*.output")' | ${TESTSYS} \
+                | egrep -v '(Timestamp|Version)' | tee $*.regress
+\end{verbatim}
+The input Makefile extracts {\bf algebra.regress} and then calls 
+make to process this file.
+
+This keeps the regression test list in the algebra Makefile.
+
+\subsection{help documentation as algebra test files}
+
+
 \section{debugsys}
 The "debugsys" executable is the "interpsys" image but it is
 built using the interpreted lisp code rather than using compiled
diff --git a/src/doc/spadhelp.pamphlet b/src/doc/spadhelp.pamphlet
index cda0ac8..024164b 100644
--- a/src/doc/spadhelp.pamphlet
+++ b/src/doc/spadhelp.pamphlet
@@ -1482,33 +1482,40 @@ syntax        trace      undo       what       while
 
 Available algebra help topics are:
 
-AssociationList (ALIST)         BalancedBinaryTree (BBTREE)
-BasicOperator (BOP)             BinaryExpansion (BINARY)
-BinarySearchTree (BSTREE)       CardinalNumber (CARD)
-CartesianTensor (CARTEN)        Character (CHAR)
-CharacterClass (CCLASS)         CliffordAlgebra (CLIF)
-Complex (COMPLEX)               ContinuedFraction (CONTFRAC)
-CycleIndicators (CYCLES)        DeRhamComplex (DERHAM)
-DecimalExpansion (DECIMAL)      DistributedMultivariatePolynomial (DMP)
-DoubleFloat (DFLOAT)            EqTable (EQTBL)
-Equation (EQ)                   Factored (FR)
-FactoredFunctions2 (FR2)        File (FILE)
-FileName (FNAME)                FlexibleArray (FARRAY)
-Float (FLOAT)                   Fraction (FR)
+AssociationList (ALIST)          BalancedBinaryTree (BBTREE)
+BasicOperator (BOP)              BinaryExpansion (BINARY)
+BinarySearchTree (BSTREE)        CardinalNumber (CARD)
+CartesianTensor (CARTEN)         Character (CHAR)
+CharacterClass (CCLASS)          CliffordAlgebra (CLIF)
+Complex (COMPLEX)                ContinuedFraction (CONTFRAC)
+CycleIndicators (CYCLES)         DeRhamComplex (DERHAM)
+DecimalExpansion (DECIMAL)       DistributedMultivariatePolynomial (DMP)
+DoubleFloat (DFLOAT)             EqTable (EQTBL)
+Equation (EQ)                    Factored (FR)
+FactoredFunctions2 (FR2)         File (FILE)
+FileName (FNAME)                 FlexibleArray (FARRAY)
+Float (FLOAT)                    Fraction (FR)
 FullPartialFractionExpansion (FPARFRAC)
 GeneralDistributedMultivariatePolynomial (GDMP)
-GeneralSparseTable (GSTBL)      GroebnerFactorizationPackage (GBF)
-Heap (HEAP)                     HexadecimalExpansion (HEXADEC)
+GeneralSparseTable (GSTBL)       GroebnerFactorizationPackage (GBF)
+Heap (HEAP)                      HexadecimalExpansion (HEXADEC)
 HomogeneousDistributedMultivariatePolynomial (HDMP)
-Integer (INT)                   IntegerLinearDependence (ZLINDEP)
+Integer (INT)                    IntegerLinearDependence (ZLINDEP)
 IntegerNumberTheoryFunctions (INTHEORY)
-Kernel (KERNEL)                 KeyedAccessFile (KAFILE)
-LexTriangularPackage (LEXTRIPK) Library (LIB)
-LieExponentials (LEXP)          LinearOrdinaryDifferentialOperator (LODO)
+Kernel (KERNEL)                  KeyedAccessFile (KAFILE)
+LexTriangularPackage (LEXTRIPK)  Library (LIB)
+LieExponentials (LEXP)           LinearOrdinaryDifferentialOperator (LODO)
 LinearOrdinaryDifferentialOperator1 (LODO1)
 LinearOrdinaryDifferentialOperator2 (LODO2)
-RealSolvePackage (REALSOLV)
-RomanNumeral (ROMAN)
+List (LIST)                      LyndonWord (LWORD)
+Magma (MAGMA)                    MakeFunction (MKFUNC)
+MappingPackage1 (MAPPKG1)        MappingPackage2 (MAPPKG2)
+MappingPackage3 (MAPPKG3)        Matrix (MATRIX)
+Multiset (MSET)                  MultivariatePolynomial (MPOLY)
+None (NONE)                      Octonion (OCT)
+OneDimensionalArray (ARRAY1)
+PlaneAlgebraicCurvePlot (ACPLOT) RealSolvePackage (REALSOLV)
+RomanNumeral (ROMAN)             TwoDimensionalViewport (VIEW2D)
 
 @ 
 
diff --git a/src/input/Makefile.pamphlet b/src/input/Makefile.pamphlet
index 6a8e7e0..38b647a 100644
--- a/src/input/Makefile.pamphlet
+++ b/src/input/Makefile.pamphlet
@@ -281,9 +281,6 @@ OUTS= ffrac.output     \
       xpoly.output     xpr.output       \
       zdsolve.output   zimmer.output    zlindep.output 
 
-# new algebra tests based on documentation
-ALGEBRA=INTHEORY.output VIEW2D.output TESTFR.output
-
 REGRES= algaggr.regress algbrbf.regress  algfacob.regress alist.regress  \
     allfact.regress   antoine.regress \
     arith.regress     array1.regress   array2.regress \
@@ -361,7 +358,7 @@ REGRES= algaggr.regress algbrbf.regress  algfacob.regress 
alist.regress  \
 IN=     ${SRC}/input
 MID=   ${INT}/input
 
-all: ${OUTS} ${ALGEBRA} ${REGRES} 
+all: ${OUTS} ${REGRES} 
        @ echo 0 starting algebra regression testing
        @ (cd ${MID} ; \
          ${TANGLE} -t8 -R"algebra.regress" ${SRC}/algebra/Makefile.pamphlet \




reply via email to

[Prev in Thread] Current Thread [Next in Thread]