login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

The language used for programming Axiom is called [SPAD]?. In fact, [SPAD]? has a cousin, originally intended as a successor called Aldor which can be used alternatively to spad. There has not been a decision yet as to whether new packages should be written in Aldor or in spad.

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.

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

There has been quite a lot of discussion on the axiom-developer mailing list about the future of Axiom and Aldor.

There are two more or less unrelated directions:

  • using Aldor for Axiom
  • Conversion of the Axiom library to Aldor.

    This is the first point on the list of projects in the preface to the Aldor documentation. On the other hand, Tim Daly says that this is unfeasible. Note that Aldor syntax is already supported in Axiom, although I remember vaguely that the support is not complete. Although the structure of the type system of the Aldor libraries is similar to that of Axiom, there are fundamental differences, too. However, I think in order to survive, Axiom and Aldor should try to converge, there are not that many Axiom users around nowadays and other CAS have much stronger support. First steps would include

    • documenting the differences
    • look whether there are Aldor libraries that could be used in Axiom straight away.

Advance Topics

[Category Theory and Axiom]?
How does Axiom differ from category theory. How to implement category theory concepts in Axiom.




  Subject:   Be Bold !!
  ( 13 subscribers )  
Please rate this page: