axiom-developer
[Top][All Lists]

## [Axiom-developer] [Programming Axiom]

 From: Bill Page Subject: [Axiom-developer] [Programming Axiom] Date: Wed, 16 Feb 2005 20:40:44 -0600

```??changed:
-However there has been quite a lot of
Introduction

*(based on an email from Tim Daly, Thursday, February 13, 2003)*

The primary documentation on Axiom is the book by Richard Jenks
and Robert Sutor "Axiom, The Scientific Computation System"
Springer-Verlag, 0-387-97855-0 1992. A revised copy of this book
is available online see "Axiom Documentation":AxiomDocumentationAndCommunity.

The language used in Axiom is called Spad (a contraction of Scratchpad,
the original name for Axiom). During the Scratchpad days we decided to
rewrite the compiler (for the nth time, as both Axiom and its language
have always been an ongoing, evolving research effort). The result was
both the current internal spad compiler, that lives in the interpreter,
and an external stand-alone compiler written in C. The external compiler
accepts the spad language (modulo some constraints based on the fact
that it (a) doesn't have the lisp runtime and (b) can link to non-lisp
code). The external compiler went thru its own name evolution, called
A-sharp (A#), AxiomXL, and now Aldor. Aldor programs will run in Axiom
(assuming you don't use various non-axiom libraries, etc). Look at the
site www.aldor.org for details. http://www.aldor.org/docs/HTML/chap21.html
will bring you to a tutorial I wrote which shows how to create a
simple stand-alone polynomial type in Aldor.

You might also want to read http://www.aldor.org/docs/HTML/chap1.html#1

The {spad,aldor} language supports parameterized types (e.g.
Matrix(Polynomial(Fraction(Integer))) , that is, an object can
be a Matrix of Polynomials with coefficients which are Fractions
of Integers) which are most useful in mathematics. In fact, types
carry all of the meaning of expressions. The expression::

(1) -> x:=matrix([[2,2],[2,2]])

+2  2+
(1)  |    |
+2  2+

Type: Matrix Integer

creates a matrix of integers. Computing (x-x) should give you
the zero matrix, not the integer 0, as you will get in some systems::

(2) -> x-x

+0  0+
(2)  |    |
+0  0+
Type: Matrix Integer

Strictly speaking, Axiom is not really an object oriented system in
the sense of Smalltalk. In Smalltalk computing 2+3 means that you send the
"object" 2 the message "+ 3". In Axiom, 2+3 is computed by deciding that::

"2" is of type PositiveInteger,
"3" is of type PositiveInteger
"+" is a function that computes
"+(PositiveInteger, PositiveInteger) => PositiveInteger"

and so it applies the function.

Axiom, unlike Java, matches not only the argument types but also the
result type so the matching is much more explicit (that is, painful).

I would tend to argue, although not with much religious fire,
that Axiom is not an object oriented programming system or language.
However, it is entirely possible to think of the spad programs as
"classes" (in the java sense) with "methods" and a private data
representation. The whole type hierarchy, including all of the
dozens of data structures, can be thought of as an object-oriented
type hierarchy.

Axiom and Aldor

However there has been quite a lot of

??changed:
-    It seems that this can be done. See
-    http://lists.nongnu.org/archive/html/axiom-mail/2004-09/msg00018.html and
-    the thread around it for instructions. It would be great if somebody could
-    describe how to do it here.
http://lists.nongnu.org/archive/html/axiom-mail/2004-09/msg00018.html