Hi,
here are some minor modifications of bookvol1 and ComputerTutorial.
In bookvol1 there were two nearly identical sections about the "%"
macro. I removed one and moved a short explanation to the place "%" is
used the first time.
In ComputerTutorial I changed all occurences of "\<\<" in verbatim
environments into "<<" as (at least my) latex dosn't execute the
command there. I also added ComputerTutorial to the Makefile.phamphlet.
There is more duplication in the tutorial. I found that
distracting. Reading something I had already read, I got bored, started
to skip sections and finally was out of it. I would like to splice those
sections in where they belong or remove them. Is that an acceptable
policy?
Frithjof
--- bookvol1.org.pamphlet 2006-08-02 14:16:49.000000000 +0200
+++ bookvol1.pamphlet 2006-08-05 01:59:19.734104296 +0200
@@ -421,6 +421,11 @@
\end{array}
\right]
$$
+
+Note the use of ``\%'' here. This means the value of the last
+expression we computed. In this case it is the matrix we defined
+above.
+
\returnType{Type: Union(Matrix Fraction Polynomial Complex Integer,...)}
\subsection{HyperDoc}
@@ -645,10 +650,8 @@
$$
\returnType{Type: Expression Integer}
-\index{\%}
-Note the use of ``\%'' here. This means the value of the last
-expression we computed. In this case it is the long expression
-above.
+Here again we use ''\%'' for the last result, that is the long expression
+above.
\subsection{Pattern Matching}
@@ -1358,46 +1361,6 @@
$$
\returnType{Type: Fraction Integer}
-\subsection{Previous Results}
-\label{sec:Previous Results}
-\index{\%}
-\index{\%\%}
-Use the percent sign ``{\tt \%}'' to refer to the last result.
-\index{result!previous} Also, use ``{\tt \%\%}' to refer to
-previous results. [EMAIL PROTECTED] ``{\tt \%\%(-1)}'' is
-equivalent to ``{\tt \%}'', ``{\tt \%\%(-2)}'' returns the next to
-the last result, and so on. ``{\tt \%\%(1)}'' returns the result from
-step number 1, ``{\tt \%\%(2)}'' returns the result from step number 2,
-and so on. ``{\tt \%\%(0)}'' is not defined.
-
-This is ten to the tenth power.
-\spadcommand{10 ** 10}
-$$
-10000000000
-$$
-\returnType{Type: PositiveInteger}
-
-This is the last result minus one.
-\spadcommand{\% - 1}
-$$
-9999999999
-$$
-\returnType{Type: PositiveInteger}
-
-This is the last result.
-\spadcommand{\%\%(-1)}
-$$
-9999999999
-$$
-\returnType{Type: PositiveInteger}
-
-This is the result from step number 1.
-\spadcommand{\%\%(1)}
-$$
-10000000000
-$$
-\returnType{Type: PositiveInteger}
-
\subsection{Some Types}
\label{sec:Some Types}
Everything in Axiom has a type. The type determines what operations
@@ -1841,8 +1804,7 @@
$$
\returnType{Type: Fraction Integer}
-\index{\%}
-where ``\%'' represents the previous {\it result} (not the calculation).
+where again ``\%'' represents the previous {\it result} (not the calculation).
Although Axiom has the ability to work with floating-point numbers to
a very high precision it must be remembered that calculations with these
@@ -2472,16 +2434,52 @@
\returnType{Type: PositiveInteger}
\subsection{Accessing Earlier Results}
+\label{sec:Accesing Earlier Results}
\index{\%}
\index{\%\%}
[EMAIL PROTECTED]
[EMAIL PROTECTED]
+
The ``\%'' macro represents the result of the previous computation. The
``\%\%'' macro is available which takes a single integer argument. If the
argument is positive then it refers to the step number of the calculation
where the numbering begins from one and can be seen at the end of each
prompt (the number in parentheses). If the argument is negative then it
-refers to previous results counting backwards from the last result. That is,
-``\%\%(-1)'' is the same as ``\%''. The value of ``\%\%(0)'' is not defined and
-will generate an error if requested.
+refers to previous results counting backwards from the last result.
+
+That is,``{\tt \%\%(-1)}'' is equivalent to ``{\tt \%}'',
+``{\tt\%\%(-2)}'' returns the next to the last result, and so on.
+``{\tt\%\%(1)}'' returns the result from step number 1, ``{\tt \%\%(2)}''
+returns the result from step number 2, and so on. The value of
+``\%\%(0)'' is not defined and will generate an error if requested.
+
+This is ten to the tenth power.
+\spadcommand{10 ** 10}
+$$
+10000000000
+$$
+\returnType{Type: PositiveInteger}
+
+This is the last result minus one.
+\spadcommand{\% - 1}
+$$
+9999999999
+$$
+\returnType{Type: PositiveInteger}
+
+This is the last result.
+\spadcommand{\%\%(-1)}
+$$
+9999999999
+$$
+\returnType{Type: PositiveInteger}
+
+This is the result from step number 1.
+\spadcommand{\%\%(1)}
+$$
+10000000000
+$$
+\returnType{Type: PositiveInteger}
\subsection{Splitting Expressions Over Several Lines}
Although Axiom will quite happily accept expressions that are longer than
--- ComputerTutorial.org.pamphlet 2006-08-05 02:31:26.139246200 +0200
+++ ComputerTutorial.pamphlet 2006-08-05 02:28:39.053647072 +0200
@@ -151,7 +151,7 @@
\begin{small}
\begin{verbatim}
#include "axllib"
- print \<\< "hello, world" \<\< newline;
+ print << "hello, world" << newline;
\end{verbatim}
\end{small}
@@ -197,9 +197,9 @@
}
import from SingleInteger;
-print \<\< signum 10 \<\< newline;
-print \<\< signum 0 \<\< newline;
-print \<\< signum(-10) \<\< newline;
+print << signum 10 << newline;
+print << signum 0 << newline;
+print << signum(-10) << newline;
\end{verbatim}
\end{small}
@@ -307,7 +307,7 @@
\begin{small}
\begin{verbatim}
- (stream: TextWriter) \<\< (thing: String): TextWriter ==
+ (stream: TextWriter) << (thing: String): TextWriter ==
\end{verbatim}
\end{small}
@@ -321,7 +321,7 @@
\begin{small}
\begin{verbatim}
- print \<\< "first thing" \<\< "second thing" \<\< ... \<\< newline;
+ print << "first thing" << "second thing" << ... << newline;
\end{verbatim}
\end{small}
@@ -329,7 +329,7 @@
\begin{small}
\begin{verbatim}
- ((((print \<\< "first thing") \<\< "second thing") \<\< ...) \<\< newline);
+ ((((print << "first thing") << "second thing") << ...) << newline);
\end{verbatim}
\end{small}
@@ -360,9 +360,9 @@
\begin{small}
\begin{verbatim}
- print \<\< signum(10) \<\< newline;
- print \<\< signum(0) \<\< newline;
- print \<\< signum(-10) \<\< newline;
+ print << signum(10) << newline;
+ print << signum(0) << newline;
+ print << signum(-10) << newline;
\end{verbatim}
\end{small}
@@ -398,9 +398,9 @@
import from SingleInteger;
import from Properties;
-print \<\< signum(10) \<\< newline;
-print \<\< signum(0) \<\< newline;
-print \<\< signum(-10) \<\< newline;
+print << signum(10) << newline;
+print << signum(0) << newline;
+print << signum(-10) << newline;
\end{verbatim}
\end{small}
@@ -813,7 +813,7 @@
\begin{small}
\begin{verbatim}
- print \<\< new(10, char "x")
+ print << new(10, char "x")
\end{verbatim}
\end{small}
@@ -831,7 +831,7 @@
\begin{small}
\begin{verbatim}
- \<\<: (TextWriter, %) -> TextWriter;
+ <<: (TextWriter, %) -> TextWriter;
\end{verbatim}
\end{small}
@@ -847,10 +847,10 @@
\begin{small}
\begin{verbatim}
- (port: TextWriter) \<\< (term1: %): TextWriter == {
- port \<\< rep(term1).coef;
- port \<\< "*";
- port \<\< rep(term1).var
+ (port: TextWriter) << (term1: %): TextWriter == {
+ port << rep(term1).coef;
+ port << "*";
+ port << rep(term1).var
}
\end{verbatim}
\end{small}
@@ -886,7 +886,7 @@
\begin{small}
\begin{verbatim}
- port \<\< rep(term1).coef;
+ port << rep(term1).coef;
\end{verbatim}
\end{small}
@@ -895,7 +895,7 @@
\begin{small}
\begin{verbatim}
- \<\<: (TextWriter, SingleInteger) -> TextWriter
+ <<: (TextWriter, SingleInteger) -> TextWriter
\end{verbatim}
\end{small}
@@ -913,7 +913,7 @@
\begin{small}
\begin{verbatim}
- \<\<: (TextWriter, String) -> TextWriter
+ <<: (TextWriter, String) -> TextWriter
\end{verbatim}
\end{small}
@@ -949,7 +949,7 @@
\begin{small}
\begin{verbatim}
- port \<\< rep(term1).var;
+ port << rep(term1).var;
\end{verbatim}
\end{small}
@@ -958,7 +958,7 @@
\begin{small}
\begin{verbatim}
- \<\<: (TextWriter, Character) -> TextWriter
+ <<: (TextWriter, Character) -> TextWriter
\end{verbatim}
\end{small}
@@ -1097,7 +1097,7 @@
Term: with {
new: (SingleInteger, Character) -> %;
dispose!: % -> ();
- \<\<: (TextWriter, %) -> TextWriter;
+ <<: (TextWriter, %) -> TextWriter;
coef: % -> SingleInteger;
var: % -> Character;
}
@@ -1111,9 +1111,9 @@
dispose!(ignore: %):() == {}
(port: TextWriter) \<\< (term1: %): TextWriter == {
- port \<\< rep(term1).coef;
- port \<\< "*";
- port \<\< rep(term1).var
+ port << rep(term1).coef;
+ port << "*";
+ port << rep(term1).var
}
coef(term: %): SingleInteger == rep(term).coef;
@@ -1125,9 +1125,9 @@
import from Character;
import from Term;
term1 := new(3, char "x");
-print \<\< term1 \<\< newline;
-print \<\< coef term1 \<\< newline;
-print \<\< var term1 \<\< newline;
+print << term1 << newline;
+print << coef term1 << newline;
+print << var term1 << newline;
dispose! term1;
\end{verbatim}
@@ -1260,14 +1260,14 @@
define BasicType: Category == with {
=: (%, %) -> Boolean; ++ Equality test.
~=: (%, %) -> Boolean; ++ Inequality test.
- \<\<: (TextWriter, %) -> TextWriter; ++ Basic output.
- \<\<: % -> TextWriter -> TextWriter; ++ Basic output.
+ <<: (TextWriter, %) -> TextWriter; ++ Basic output.
+ <<: % -> TextWriter -> TextWriter; ++ Basic output.
sample: %; ++ Example element.
hash: % -> SingleInteger; ++ Hashing function.
default (x: %) ~= (y: %): Boolean == not (x = y);
default hash(x: %): SingleInteger == (0$Machine)::SingleInteger;
- default (\<\<)(x: %)(p: TextWriter): TextWriter == p \<\< x;
+ default (<<)(x: %)(p: TextWriter): TextWriter == p << x;
}
\end{verbatim}
\end{small}
@@ -1415,7 +1415,7 @@
Term: BasicType with {
new: (SingleInteger, Character) -> %;
dispose!: % -> ();
- \<\<: (TextWriter, %) -> TextWriter;
+ <<: (TextWriter, %) -> TextWriter;
coef: % -> SingleInteger;
var: % -> Character;
}
@@ -1432,13 +1432,13 @@
\begin{verbatim}
=: (%, %) -> Boolean; ++ Equality test.
~=: (%, %) -> Boolean; ++ Inequality test.
- \<\<: (TextWriter, %) -> TextWriter; ++ Basic output.
- \<\<: % -> TextWriter -> TextWriter; ++ Basic output.
+ <<: (TextWriter, %) -> TextWriter; ++ Basic output.
+ <<: % -> TextWriter -> TextWriter; ++ Basic output.
sample: %; ++ Example element.
hash: % -> SingleInteger; ++ Hashing function.
new: (SingleInteger, Character) -> %;
dispose!: % -> ();
- \<\<: (TextWriter, %) -> TextWriter;
+ <<: (TextWriter, %) -> TextWriter;
coef: % -> SingleInteger;
var: % -> Character;
\end{verbatim}
@@ -1519,7 +1519,7 @@
\begin{small}
\begin{verbatim}
- \<\<: (TextWriter, %) -> TextWriter;
+ <<: (TextWriter, %) -> TextWriter;
\end{verbatim}
\end{small}
@@ -1533,7 +1533,7 @@
\begin{small}
\begin{verbatim}
- (stream: TextWriter) \<\< (poly: %): TextWriter
+ (stream: TextWriter) << (poly: %): TextWriter
\end{verbatim}
\end{small}
@@ -1544,7 +1544,7 @@
\begin{small}
\begin{verbatim}
- stream \<\< poly \<\< newline;
+ stream << poly << newline;
\end{verbatim}
\end{small}
@@ -1557,11 +1557,11 @@
\begin{small}
\begin{verbatim}
- (stream: TextWriter) \<\< (poly: %): TextWriter == {
+ (stream: TextWriter) << (poly: %): TextWriter == {
size: SingleInteger := #(rep(poly));
for i in 1..(size-1) repeat
- stream \<\< poly.i \<\< "^" \<\< (size - i) \<\< " + ";
- stream \<\< poly.size
+ stream << poly.i << "^" << (size - i) << " + ";
+ stream << poly.size
}
\end{verbatim}
\end{small}
@@ -1585,11 +1585,11 @@
\begin{small}
\begin{verbatim}
- (stream: TextWriter) \<\< (poly: %): TextWriter == {
+ (stream: TextWriter) << (poly: %): TextWriter == {
size: SingleInteger := #(rep(poly));
for i in 1..(size-1) repeat
- stream \<\< poly.i \<\< "^" \<\< (size - i) \<\< " + ";
- stream \<\< coef(poly.size)
+ stream << poly.i << "^" << (size - i) << " + ";
+ stream << coef(poly.size)
}
\end{verbatim}
\end{small}
@@ -1599,12 +1599,12 @@
\begin{small}
\begin{verbatim}
- (stream: TextWriter) \<\< (poly: %): TextWriter == {
+ (stream: TextWriter) << (poly: %): TextWriter == {
size: SingleInteger := #(rep(poly));
for i in 1..(size-2) repeat
- stream \<\< poly.i \<\< "^" \<\< (size-i) \<\< " + ";
- stream \<\< poly.(size-1) \<\< " + "
- stream \<\< coef(poly.size)
+ stream << poly.i << "^" << (size-i) << " + ";
+ stream << poly.(size-1) << " + "
+ stream << coef(poly.size)
}
\end{verbatim}
\end{small}
@@ -1629,19 +1629,19 @@
\begin{small}
\begin{verbatim}
- (stream: TextWriter) \<\< (poly: %): TextWriter == {
+ (stream: TextWriter) << (poly: %): TextWriter == {
size: SingleInteger := #(rep(poly));
for i in 1..(size-2) repeat
if not zero?(poly.i) then
- stream \<\< poly.i \<\< "^" \<\< (size - i) \<\< " + ";
+ stream << poly.i << "^" << (size - i) << " + ";
if not zero?(poly.(size-1)) then
- stream \<\< poly.(size-1) \<\< " + ";
+ stream << poly.(size-1) << " + ";
if zero?(poly.size) then
- stream \<\< 0
+ stream << 0
else
- stream \<\< coef(poly.size)
+ stream << coef(poly.size)
}
\end{verbatim}
\end{small}
@@ -1662,20 +1662,20 @@
\begin{small}
\begin{verbatim}
- (stream: TextWriter) \<\< (poly: %): TextWriter == {
+ (stream: TextWriter) << (poly: %): TextWriter == {
size: SingleInteger := #(rep(poly));
prefix: String := "";
for i in 1..(size-2) repeat
if not zero?(poly.i) then {
- stream \<\< prefix \<\< poly.i \<\< "^" \<\< (size - i);
+ stream << prefix << poly.i << "^" << (size - i);
prefix := " + "
}
if not zero?(poly.(size-1)) then {
- stream \<\< prefix \<\< poly.(size-1);
+ stream << prefix << poly.(size-1);
prefix := " + "
}
if not zero?(poly.size) then
- stream \<\< prefix \<\< coef(poly.size);
+ stream << prefix << coef(poly.size);
stream
}
\end{verbatim}
@@ -1735,23 +1735,23 @@
\begin{small}
\begin{verbatim}
- (stream: TextWriter) \<\< (poly: %): TextWriter == {
- zero? poly => stream \<\< 0;
+ (stream: TextWriter) << (poly: %): TextWriter == {
+ zero? poly => stream << 0;
size: SingleInteger := #(rep(poly));
prefix: String := "";
for i in 1..(size-2) repeat
if not zero?(poly.i) then {
- stream \<\< prefix \<\< poly.i \<\< "^" \<\< (size-i);
+ stream << prefix << poly.i << "^" << (size-i);
prefix := " + "
}
if not zero?(poly.(size-1)) then {
- stream \<\< prefix \<\< poly.(size-1);
+ stream << prefix << poly.(size-1);
prefix := " + "
}
if not zero?(poly.size) then
- stream \<\< prefix \<\< coef(poly.size);
+ stream << prefix << coef(poly.size);
stream
}
\end{verbatim}
@@ -1822,24 +1822,24 @@
abs(term: Term): Term ==
if negative? term then -term else term;
- (stream: TextWriter) \<\< (poly: %): TextWriter == {
- zero? poly => stream \<\< 0;
+ (stream: TextWriter) << (poly: %): TextWriter == {
+ zero? poly => stream << 0;
size: SingleInteger := #(rep(poly));
prefix: String := if negative?(poly.1) then " - " else "";
for i in 1..(size-2) repeat
if not zero?(poly.i) then {
- stream \<\< prefix \<\< abs(poly.i);
- stream \<\< "^" \<\< (size - i);
+ stream << prefix << abs(poly.i);
+ stream << "^" << (size - i);
prefix := prefix(poly.(i+1))
}
if not zero?(poly.(size-1)) then {
- stream \<\< prefix \<\< abs(poly.(size-1));
+ stream << prefix << abs(poly.(size-1));
prefix := prefix(poly.size)
}
if not zero?(poly.size) then
- stream \<\< prefix \<\< abs(coef(poly.size));
+ stream << prefix << abs(coef(poly.size));
stream
}
\end{verbatim}
@@ -1887,7 +1887,7 @@
Term: BasicType with {
new: (SingleInteger, Character) -> %;
dispose!: % -> ();
- \<\<: (TextWriter, %) -> TextWriter;
+ <<: (TextWriter, %) -> TextWriter;
coef: % -> SingleInteger;
var: % -> Character;
zero?: % -> Boolean;
@@ -1906,12 +1906,12 @@
dispose!(ignore: %):() == {}
- (stream: TextWriter) \<\< (term: %): TextWriter ==
+ (stream: TextWriter) << (term: %): TextWriter ==
if rep(term).coef = 1 then
- stream \<\< rep(term).var
+ stream << rep(term).var
else {
- stream \<\< rep(term).coef;
- stream \<\< "*" \<\< rep(term).var
+ stream << rep(term).coef;
+ stream << "*" << rep(term).var
}
coef(term: %): SingleInteger == rep(term).coef;
@@ -1950,7 +1950,7 @@
Polynomial: with {
new: List(Term) -> %;
dispose!: % -> ();
- \<\<: (TextWriter, %) -> TextWriter;
+ <<: (TextWriter, %) -> TextWriter;
leadingMonomial: % -> Term;
apply: (%, SingleInteger) -> Term;
degree: % -> SingleInteger;
@@ -1981,25 +1981,25 @@
abs(term: Term): Term ==
if negative? term then -term else term;
- (stream: TextWriter) \<\< (poly: %): TextWriter == {
- zero? poly => stream \<\< 0;
+ (stream: TextWriter) << (poly: %): TextWriter == {
+ zero? poly => stream << 0;
size: SingleInteger := #(rep(poly));
sign: String := if negative?(poly.1) then " - " else "";
for i in 1..(size-2) repeat
if not zero?(poly.i) then {
- stream \<\< sign \<\< abs(poly.i);
- stream \<\< "^" \<\< (size - i);
+ stream << sign << abs(poly.i);
+ stream << "^" << (size - i);
sign := prefix(poly.(i + 1))
}
if not zero?(poly.(size - 1)) then {
- stream \<\< sign \<\< abs(poly.(size-1));
+ stream << sign << abs(poly.(size-1));
sign := prefix(poly.size)
}
if not zero?(poly.size) then
- stream \<\< sign \<\< abs(coef(poly.size));
+ stream << sign << abs(coef(poly.size));
stream
}
@@ -2027,17 +2027,17 @@
term4 := new(0, var);
term5 := new(-3, var);
-- term6 := -term5;
-print \<\< new(list(term5,term5,term5)) \<\< newline; -- negative signs
-print \<\< new(list(term3,term2,term1)) \<\< newline; -- 1 elision
-print \<\< new(list(term1,term2,term3)) \<\< newline;
-print \<\< new(list(term4,term2,term3)) \<\< newline;
-print \<\< new(list(term1,term4,term3)) \<\< newline;
-print \<\< new(list(term4,term4,term3)) \<\< newline;
-print \<\< new(list(term1,term2,term4)) \<\< newline; -- bad leading term
-print \<\< new(list(term4,term2,term4)) \<\< newline; -- bad leading term
-print \<\< new(list(term1,term4,term4)) \<\< newline; -- bad leading term
-print \<\< new(list(term4,term4,term4)) \<\< newline; -- bad leading term
-print \<\< new(list())@Polynomial \<\< newline; -- true zero polynomial
+print << new(list(term5,term5,term5)) << newline; -- negative signs
+print << new(list(term3,term2,term1)) << newline; -- 1 elision
+print << new(list(term1,term2,term3)) << newline;
+print << new(list(term4,term2,term3)) << newline;
+print << new(list(term1,term4,term3)) << newline;
+print << new(list(term4,term4,term3)) << newline;
+print << new(list(term1,term2,term4)) << newline; -- bad leading term
+print << new(list(term4,term2,term4)) << newline; -- bad leading term
+print << new(list(term1,term4,term4)) << newline; -- bad leading term
+print << new(list(term4,term4,term4)) << newline; -- bad leading term
+print << new(list())@Polynomial << newline; -- true zero polynomial
#endif -- TEST
@@ -2176,7 +2176,7 @@
\begin{small}
\begin{verbatim}
-print \<\< new(list(term5,term5,term5)) \<\< newline; -- negative signs
+print << new(list(term5,term5,term5)) << newline; -- negative signs
\end{verbatim}
\end{small}
@@ -2184,7 +2184,7 @@
\begin{small}
\begin{verbatim}
-print \<\< new(list(term3,term2,term1)) \<\< newline; -- 1 elision
+print << new(list(term3,term2,term1)) << newline; -- 1 elision
\end{verbatim}
\end{small}
@@ -2192,14 +2192,14 @@
\begin{small}
\begin{verbatim}
-print \<\< new(list(term1,term2,term3)) \<\< newline;
-print \<\< new(list(term4,term2,term3)) \<\< newline;
-print \<\< new(list(term1,term4,term3)) \<\< newline;
-print \<\< new(list(term4,term4,term3)) \<\< newline;
-print \<\< new(list(term1,term2,term4)) \<\< newline; -- bad leading term
-print \<\< new(list(term4,term2,term4)) \<\< newline; -- bad leading term
-print \<\< new(list(term1,term4,term4)) \<\< newline; -- bad leading term
-print \<\< new(list(term4,term4,term4)) \<\< newline; -- bad leading term
+print << new(list(term1,term2,term3)) << newline;
+print << new(list(term4,term2,term3)) << newline;
+print << new(list(term1,term4,term3)) << newline;
+print << new(list(term4,term4,term3)) << newline;
+print << new(list(term1,term2,term4)) << newline; -- bad leading term
+print << new(list(term4,term2,term4)) << newline; -- bad leading term
+print << new(list(term1,term4,term4)) << newline; -- bad leading term
+print << new(list(term4,term4,term4)) << newline; -- bad leading term
\end{verbatim}
\end{small}
@@ -2207,8 +2207,8 @@
\begin{small}
\begin{verbatim}
-print \<\< new(list())@Polynomial \<\< newline; -- true zero polynomial
-print \<\< [EMAIL PROTECTED] \<\< newline; -- true zero polynomial
+print << new(list())@Polynomial << newline; -- true zero polynomial
+print << [EMAIL PROTECTED] << newline; -- true zero polynomial
\end{verbatim}
\end{small}
@@ -2216,10 +2216,10 @@
\begin{small}
\begin{verbatim}
-print \<\< term1 + term2 \<\< newline;
-print \<\< term1 - term2 \<\< newline;
-print \<\< term2 - term1 \<\< newline;
-print \<\< term1 - term1 \<\< newline;
+print << term1 + term2 << newline;
+print << term1 - term2 << newline;
+print << term2 - term1 << newline;
+print << term1 - term1 << newline;
\end{verbatim}
\end{small}
%#endif --example5
@@ -2236,7 +2236,7 @@
Term: BasicType with {
new: (SingleInteger, Character) -> %;
dispose!: % -> ();
- \<\<: (TextWriter, %) -> TextWriter;
+ <<: (TextWriter, %) -> TextWriter;
coef: % -> SingleInteger;
var: % -> Character;
zero?: % -> Boolean;
@@ -2255,12 +2255,12 @@
dispose!(ignore: %):() == {}
- (stream: TextWriter) \<\< (term: %): TextWriter ==
+ (stream: TextWriter) << (term: %): TextWriter ==
if rep(term).coef = 1 then
- stream \<\< rep(term).var
+ stream << rep(term).var
else {
- stream \<\< rep(term).coef;
- stream \<\< "*" \<\< rep(term).var
+ stream << rep(term).coef;
+ stream << "*" << rep(term).var
}
coef(term: %): SingleInteger == rep(term).coef;
@@ -2299,7 +2299,7 @@
Polynomial: with {
new: List(Term) -> %;
dispose!: % -> ();
- \<\<: (TextWriter, %) -> TextWriter;
+ <<: (TextWriter, %) -> TextWriter;
leadingMonomial: % -> Term;
apply: (%, SingleInteger) -> Term;
degree: % -> SingleInteger;
@@ -2332,8 +2332,8 @@
abs(term: Term): Term ==
if negative? term then -term else term;
- (stream: TextWriter) \<\< (poly: %): TextWriter == {
- zero? poly => stream \<\< [EMAIL PROTECTED];
+ (stream: TextWriter) << (poly: %): TextWriter == {
+ zero? poly => stream << [EMAIL PROTECTED];
size: SingleInteger := #(rep(poly));
@@ -2342,16 +2342,16 @@
for i in 1..(size - 2) repeat
if not zero?(poly.i) then {
- stream \<\< sign \<\< abs(poly.i);
- stream \<\< "^" \<\< (size - i);
+ stream << sign << abs(poly.i);
+ stream << "^" << (size - i);
sign := prefix(poly.(i+1))
}
if not zero?(poly.(size-1)) then {
- stream \<\< sign \<\< abs(poly.(size-1));
+ stream << sign << abs(poly.(size-1));
sign := prefix(poly.size)
}
if not zero?(poly.size) then
- stream \<\< sign \<\< abs(coef(poly.size));
+ stream << sign << abs(coef(poly.size));
stream
}
@@ -2653,7 +2653,7 @@
Term(CoefType: OrderedRing): BasicType with {
new: (CoefType, Character) -> %;
dispose!: % -> ();
- \<\<: (TextWriter, %) -> TextWriter;
+ <<: (TextWriter, %) -> TextWriter;
coef: % -> CoefType;
var: % -> Character;
zero?: % -> Boolean;
@@ -2672,12 +2672,12 @@
dispose!(ignore: %):() == {} -- undefined
- (stream: TextWriter) \<\< (term: %): TextWriter ==
+ (stream: TextWriter) << (term: %): TextWriter ==
if rep(term).coef = 1 then
- stream \<\< rep(term).var
+ stream << rep(term).var
else {
- stream \<\< rep(term).coef;
- stream \<\< "*" \<\< rep(term).var
+ stream << rep(term).coef;
+ stream << "*" << rep(term).var
}
coef(term: %): CoefType == rep(term).coef;
@@ -2717,9 +2717,9 @@
import from Character;
import from Term SingleInteger;
-print \<\< new(0$SingleInteger,char "x") \<\< newline;
+print << new(0$SingleInteger,char "x") << newline;
import from Term Float;
-print \<\< new(0$Float,char "x") \<\< newline;
+print << new(0$Float,char "x") << newline;
#endif -- TEST
--- Makefile.org.pamphlet 2006-08-05 12:37:17.794397200 +0200
+++ Makefile.pamphlet 2006-08-05 13:19:04.263356000 +0200
@@ -151,6 +151,28 @@
@echo 8 making ${INT}/booklet.c from ${IN}/booklet.c.pamphlet
@(cd ${INT} ; \
${TANGLE} ${IN}/booklet.c.pamphlet >booklet.c )
+
+@
+\section{ComputerTutorial}
+ComputerTutorial introduces some aspects of axiom programming. It
+mainly talks about how to build your own domains and types and
+explains some concepts by comparison with C/C++.
+
+<<ComputerTutorial>>=
+${DVI}/ComputerTutorial.dvi: ${IN}/ComputerTutorial.pamphlet
+ @echo 4 building ${DVI}/ComputerTutorial.dvi from \
+ ${IN}/ComputerTutorial.pamphlet
+ @(cd ${MID} ; \
+ cp ${IN}/ComputerTutorial.pamphlet ${MID} ; \
+ if [ -n "${NOISE}" ] ; then \
+ latex ComputerTutorial.pamphlet --interaction nonstopmode
>${TMP}/trace ; \
+ latex ComputerTutorial.pamphlet --interaction nonstopmode
>${TMP}/trace ; \
+ else \
+ latex ComputerTutorial.pamphlet --interaction nonstopmode ; \
+ latex ComputerTutorial.pamphlet --interaction nonstopmode ; \
+ fi ; \
+ cp ComputerTutorial.dvi ${DVI} )
+
@
\section{The Makefile}
@@ -165,7 +187,7 @@
FILES= ${MID}/axiom.bib ${STY}/axiom.sty ${DVI}/DeveloperNotes.dvi \
${DVI}/book.dvi ${DVI}/bookvol1.dvi ${DVI}/endpaper.dvi \
- ${DVI}/Rosetta.dvi
+ ${DVI}/Rosetta.dvi ${DVI}/ComputerTutorial.dvi
CMDS=${OUT}/booklet
@@ -180,6 +202,7 @@
<<bookvol1>>
<<Endpapers>>
<<Rosetta>>
+<<ComputerTutorial>>
document:
@echo 10 documenting ${SRC}/doc
_______________________________________________
Axiom-developer mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/axiom-developer