 mathml.spad.pamphlet 20071211 07:00:45.000000000 0800
+++ mathml.spad.pamphlet.new 20071215 16:18:33.000000000 0800
@@ 25,14 +25,14 @@
At this time (20070211) the package only has a presentation
package. A content package is in the
works however it is more difficult. Unfortunately Axiom does
not make its semantics easliy available. The \spadtype{OutputForm}
+not make its semantics easily available. The \spadtype{OutputForm}
domain mediates between the individual Axiom domains and the
user visible output but \spadtype{OutputForm} does not provide full
semantic information. From my currently incomplete understanding
of Axiom it appears that remedying this would entail going back
to the individual domains and rewriting a lot of code.
However some semantics are conveyed directly by \spadtype{OutputForm} and other
things can be deduced from \spadtype{OutputForm} or form the original
+things can be deduced from \spadtype{OutputForm} or from the original
user command.
\section{Displaying MathML}
@@ 107,7 +107,7 @@
I don't know of any Axiom command that produces such an object. In
fact at present I see the case of "SUPERSUB" being used for putting
primes in the superscript position to denote ordinary differentiation.
I also only see the "SUB" case being only used to denote partial
+I also only see the "SUB" case being used to denote partial
derivatives.
\section{)set output mathml on}
@@ 116,7 +116,7 @@
Making mathml appear as output during a normal Axiom session
by invoking ")set output mathml on" proved to be a bit tedious
and seems to be undocumented. I document my experience here
in case in proves useful to somebody else trying to get a new
+in case it proves useful to somebody else trying to get a new
output format from Axiom.
In \spadtype{MathMLFormat} the functions
@@ 231,7 +231,7 @@
I don't see that this file is used anywhere but I made
the appropriate changes anyway by searching for "TEX" and
mimicing everthing for MMLFORM.
+mimicing everything for MMLFORM.
\subsection{File src/doc/axiom.bib.pamphlet}
@@ 285,14 +285,14 @@
The publicly exposed functions are:
\spadfun{coerce: E $>$ S} This function is the main one for converting
and expression in domain OutputForm into a MathML string.
+an expression in domain OutputForm into a MathML string.
\spadfun{coerceS: E $>$ S} This function is for use from the command line.
It converts an OutputForm expression into a MathML string and does
some formatting so that the output is not one long line. If you take
the output from this function, stick it in an emacs buffer in
nxmlmode and then indent according to mode, you'll get something that's
nicer to look at than comes from coerce. Note that coerceS returns
+nicer to look at than what comes from coerce. Note that coerceS returns
the same value as coerce but invokes a display function as well so that
the result will be printed twice in different formats. The need for this
is that the output from coerce is automatically formatted with line breaks
@@ 377,7 +377,7 @@
import List OutputForm
import List String
  local variables declarations and definitions
+  local variable declarations and definitions
expr: E
prec,opPrec: I
@@ 1191,15 +1191,31 @@
null args => ""
p : I := position(op,naryOps)
p < 1 => error "unknown nary op"
  need to test for "ZAG" case and divert it here, here's an
  example including "op", the args list would be the rest of this
+  need to test for "ZAG" case and divert it here
+  ex 1. continuedFraction(314159/100000)
 {{+}{3}{{ZAG}{1}{7}}{{ZAG}{1}{15}}{{ZAG}{1}{1}}{{ZAG}{1}{25}}
 {{ZAG}{1}{1}}{{ZAG}{1}{7}}{{ZAG}{1}{4}}}
  The first arg, the "3" in this case, could be a "ZAG" or something
+  this is the preconditioned output form
+  including "op", the args list would be the rest of this
+  i.e op = '+' and args = {{3}{{ZAG}{1}{7}}{{ZAG}{1}{15}}
+  {{ZAG}{1}{1}}{{ZAG}{1}{25}}{{ZAG}{1}{1}}{{ZAG}{1}{7}}{{ZAG}{1}{4}}}
+  ex 2. continuedFraction(14159/100000)
+  this one doesn't have the leading integer
+  {{+}{{ZAG}{1}{7}}{{ZAG}{1}{15}}{{ZAG}{1}{1}}{{ZAG}{1}{25}}
+  {{ZAG}{1}{1}}{{ZAG}{1}{7}}{{ZAG}{1}{4}}}
+ 
+  ex 3. continuedFraction(3,repeating [1], repeating [3,6])
+  {{+}{3}{{ZAG}{1}{3}}{{ZAG}{1}{6}}{{ZAG}{1}{3}}{{ZAG}{1}{6}}
+  {{ZAG}{1}{3}}{{ZAG}{1}{6}}{{ZAG}{1}{3}}{{ZAG}{1}{6}}
+  {{ZAG}{1}{3}}{{ZAG}{1}{6}}{...}}
+  In each of these examples the args list consists of the terms
+  following the '+' op
+  so the first arg could be a "ZAG" or something
 else, but the second arg looks like it has to be "ZAG", so maybe
  test for #args > 1 and args.2 is "ZAG".
  This test should work so long as axiom doesn't try to evaluate
  the second half of the "and" when the first half is false.
+  test for #args > 1 and args.2 contains "ZAG".
+  Note that since the resulting MathML s are nested we need
+  to handle the whole continued fraction at once, i.e. we can't
+  just look for, e.g., {{ZAG}{1}{6}}
(#args > 1) and (position("ZAG",stringify first rest args,1) > 0) =>
tmpS : S := stringify first args
position("ZAG",tmpS,1) > 0 => formatZag(args)
@@ 1224,11 +1240,17 @@
s
formatZag(args : L E) : S ==
  {{ZAG}{1}{7}}
+  args will be a list of things like this {{ZAG}{1}{7}}, the ZAG
+  must be there, the '1' and '7' could conceivably be more complex
+  expressions
tmpZag : L E := first args pretend L E
+  may want to test that tmpZag contains 'ZAG'
#args > 1 => ""formatMml(first rest tmpZag,minPrec)""formatMml(first rest rest tmpZag,minPrec)"+"formatZag(rest args)""
 ""formatMml(first rest tmpZag,minPrec)formatMml(first rest rest tmpZag,minPrec)""

+ (first args = "..."::E)@Boolean => "…"
+ position("ZAG",stringify first args,1) > 0 =>
+ ""formatMml(first rest tmpZag,minPrec)formatMml(first rest rest tmpZag,minPrec)""
+ "formatZag: Unexpected kind of ZAG"
+
formatZag1(args : L E) : S ==
 make alternative ZAG format without diminishing fonts, maybe
 use a table