axiom-developer
[Top][All Lists]
Advanced

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

[Axiom-developer] [AldorForAxiom]


From: Bill Page
Subject: [Axiom-developer] [AldorForAxiom]
Date: Tue, 30 Aug 2005 21:34:36 -0500

Changes http://page.axiom-developer.org/zope/mathaction/AldorForAxiom/diff
--

??changed:
-<hr />
-Out of Date
-
-  The information below is out of date and will be soon replaced
-
-Unfortunately, support for domains and packages is still buggy, but
-it's nearly working - thanks to Peter!
-
-Let's do an example! Let's assume you have Aldor installed. You then have to do
-a little setup:
-
-1. Grab the file 'axextend.lsp' from your Axiom source distribution, it should
-   reside in 'lsp/ccl/src/axbase/compiler/lib'. Rename it into
-   'axextend.lsp.pamphlet' and edit its second line, such that it reads 
-   '\usepackage{axiom}' instead of 
-   '\usepackage{../../../../../src/scripts/tex/axiom}'. Then run 
-   'document axextend.lsp.pamphlet', to obtain the proper lisp code. Do the 
same 
-   for the file 'foam_l.lsp', in the same directory.
-
-[152 more lines...]
More Examples

  Having put the following simple domain in a file 'test.as' ::

\begin{aldor}
#include "axiom.as"

Test: with { fact: PositiveInteger -> PositiveInteger }
   == add  { fact(n: PositiveInteger): PositiveInteger == 
              { n <= 1 => 1;
                res: PositiveInteger := 1;
                while n > 1 repeat {
                  res := res * n;
                  n := n-1; }
                res } }
\end{aldor}

??changed:
-  )lisp (load 
"/home/rubey/axiom--main--1--patch-24/lsp/ccl/src/axbase/compiler/lib/foam_l.lsp")
-  )lisp (load 
"/home/rubey/axiom--main--1--patch-24/lsp/ccl/src/axbase/compiler/lib/axextend.lsp")
-  )lisp (load "/home/rubey/aldor/linux/1.0.2/lib/runtime.lsp")
-  )lib test
-  
-  (1) -> )sh Test
-    Test  is a domain constructor
-    Abbreviation for Test is TEST 
-    This constructor is exposed in this frame.
-    Issue )edit test.as to see algebra source code for TEST 
-  
-   ------------------------------- Operations --------------------------------
-    fact : PositiveInteger -> PositiveInteger
-   
-   (1) -> fact(5)\$Test
-   
-      (1)  120
-                                                           Type: 
PositiveInteger
-
-[1 more lines...]
  )co test.as

\begin{axiom}  
)sh Test
\end{axiom}

\begin{axiom}
fact(5)$Test
\end{axiom}

Known Problems

  On Tue, 11 Jan 2005 15:43:53 +0100 **Martin Rubey** wrote:

The following Aldor construct does not yet work in Axiom.

I just tried another example, which is in fact the reason why
I would love to have Aldor working. I did not expect it to work,
and it does not, but it works *almost*. The code is as follows:

\begin{aldor}
#include "axiom"

Test: with { f: (n: PositiveInteger) -> PrimeField(n) } 
   == add { f(n: PositiveInteger): PrimeField(n) == 
              10::Integer::PrimeField(n) }
\end{aldor}

Note that such a construction -- the resulting domain depending on
the function parameter -- is currently illegal in Axiom. In Aldor
it is fine.

I compiled it with Aldor as usual, and then loaded it into Axiom.
As signature I got the slightly unusual:
\begin{axiom}
)di op f
\end{axiom}

and trying it out I obtained:
\begin{axiom}
f(5)$Test
\end{axiom}

which is roughly what I expected. However, to my great surprise,
if you turn on the debugger (beforehand. You always have to start
a fresh axiom because of the error I told you about in my previous
message) with::

  )lisp (setq |$monitorNewWorld| t)

and thus trace::

  (1) -> f(1783)$Test

the final bit reads::

  protected-symbol-warn called with (NIL)..IntegerMod 1783 wants
   positiveRemainder : (%,%) -> % from  Integer
  ---->Integer----> searching op table for:
   positiveRemainder : (%,%) -> % from  Integer
  <----#<compiled-function |INT;positiveRemainder;3$;28|> Integer
  goget stuffing slot 47 of IntegerMod 1783
  <------#<compiled-function |INT;positiveRemainder;3$;28|> Integer

  PrimeField n activating lazy slot 8: Integer
  PrimeField n activating lazy slot 9: IntegerPrimesPackage Integer

  ..PrimeField n wants
   prime? : Integer -> Boolean from  IntegerPrimesPackage Integer
  ---->IntegerPrimesPackage Integer----> searching op table for:
   prime? : Integer -> Boolean from  IntegerPrimesPackage Integer
  <----#<compiled-function |PRIMES;prime?;IB;4|>(IntegerPrimesPackage,Integer)
  goget stuffing slot 10 of PrimeField n
  <------#<compiled-function |PRIMES;prime?;IB;4|>(IntegerPrimesPackage,Integer)

which clearly tells you, that the calculation is done alright, only the
signature interferes with success.

Any ideas?

Peter said, that it's on the interpreter side. You can read the whole
thread on 
http://lists.gnu.org/archive/html/axiom-developer/2005-01/msg00154.html

Concerning his patches, Peter also pointed out that

--removed:
-Indeed, the following Aldor construct does not yet work in Axiom::
-
-  #include "axiom"
-  
-  Test: with { f: (n: PositiveInteger) -> PrimeField(n) } 
-     == add { f(n: PositiveInteger): PrimeField(n) == 
-                10::Integer::PrimeField(n) }
-
-It nearly works, as one can see from a trace done with 
-')lisp (setq |$monitorNewWorld| t)', but not quite... Peter said, that it's on 
the 
-interpreter side. You can read the whole thread on 
-http://lists.gnu.org/archive/html/axiom-developer/2005-01/msg00154.html

--
forwarded from http://page.axiom-developer.org/zope/mathaction/address@hidden




reply via email to

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