axiom-developer
[Top][All Lists]
Advanced

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

[Axiom-developer] domain containers in the axiom interpreter


From: Ralf Hemmecke
Subject: [Axiom-developer] domain containers in the axiom interpreter
Date: Sun, 21 May 2006 23:56:12 +0200
User-agent: Thunderbird 1.5.0.2 (X11/20060420)

Hello,

I've just found out that Axiom cannot handle what I believe would be trivial. Look at the following code in domcont.as. CCDP is basically nothing else than an array of objects of type CC. But CC is a category, so that domain will contain a collection of domains not of usual elements. Of course, for Aldor something like that causes no problem at all, but as you read from the output at the end of this mail, Axiom yields an error in connection with "LIST" althoug my code does not involve List at all.

This current weakness of Axiom is VERY dramatic for the aldor-combinat project. Or is someone able to build something like an array that contains the *domain* Atom (see below).

Ralf


----domcont.as
#include "axiom"
macro Z == Integer;
macro I == NonNegativeInteger;
macro machine i == i;
macro prev i == (i-1)::Z;
import from Z;
CC: Category == with {count: Z -> Z;}
Atom: CC == add {count(i: Z): Z == if i=1 then 1 else 0;}
CCDPC: Category == with {
        #: % -> Integer;
        apply: (%, Integer) -> CC;
        set!: (%, Integer, CC) -> CC;
        ccdp: Tuple CC -> %;
        data: % -> PrimitiveArray CC;
        coerce: % -> OutputForm;
}
CCDP: CCDPC == add {
        Rep == Record(len: I, arr: PrimitiveArray CC);
        import from Rep;
        #(x: %): Z == ((rep x).len) :: Z;
        data(x: %): PrimitiveArray CC == rep(x).arr;
        ccdp(t: Tuple CC): % == {
                -- The length of a tuple is SingleInteger. :-(
                -- That is different from what ")sh Tuple" says.
                len: SingleInteger == length t;
                p: PrimitiveArray CC == new(len::I, Atom);
                for i in 1..len repeat p.(prev i) := element(t, i);
                per [len::I, p];
        }
        apply(x: %, i: Z): CC == {
                data(x).(prev machine i);
        }
        set!(x: %, i: Z, C: CC): CC == {
                data(x).(prev machine i) := C;
        }
        coerce(x: %): OutputForm == (1$Integer)::OutputForm
}
--end domcont.as

(1) -> )co domcont.as
   Compiling AXIOM source code from file domcont.as using AXIOM-XL
      compiler and options
-O -Fasy -Fao -Flsp -laxiom -Mno-AXL_W_WillObsolete -DAxiom -Y $AXIOM/algebra
      Use the system command )set compiler args to change these
      options.
#1 (Warning) Deprecated message prefix: use `ALDOR_' instead of `_AXL'
"domcont.as", line 30:         apply(x: %, i: Z): CC == {
                       ..............^
[L30 C15] #2 (Warning) Function returns a domain that might not be constant (which may cause problems if it is used in a dependent type).

"domcont.as", line 33:         set!(x: %, i: Z, C: CC): CC == {
                       .............^
[L33 C14] #3 (Warning) Function returns a domain that might not be constant (which may cause problems if it is used in a dependent type).

   Compiling Lisp source code from file ./domcont.lsp
   Issuing )library command for domcont
   Reading /home/hemmecke/scratch/Aistleitner/domcont.asy
   Loading /home/hemmecke/software/Axiom/mnt/linux/autoload/bc-matrix.
   Loading /home/hemmecke/software/Axiom/mnt/linux/autoload/bc-misc.
   Loading /home/hemmecke/software/Axiom/mnt/linux/autoload/bc-solve.
   Loading /home/hemmecke/software/Axiom/mnt/linux/autoload/bc-util.
   Loading /home/hemmecke/software/Axiom/mnt/linux/autoload/ht-util.
   Loading /home/hemmecke/software/Axiom/mnt/linux/autoload/htsetvar.
   Loading /home/hemmecke/software/Axiom/mnt/linux/autoload/ht-root.
   Loading /home/hemmecke/software/Axiom/mnt/linux/autoload/br-con.
   Loading /home/hemmecke/software/Axiom/mnt/linux/autoload/br-data.
   Loading /home/hemmecke/software/Axiom/mnt/linux/autoload/showimp.
   Loading /home/hemmecke/software/Axiom/mnt/linux/autoload/br-op1.
   Loading /home/hemmecke/software/Axiom/mnt/linux/autoload/br-op2.
   Loading /home/hemmecke/software/Axiom/mnt/linux/autoload/br-search.
   Loading /home/hemmecke/software/Axiom/mnt/linux/autoload/br-util.
   Loading /home/hemmecke/software/Axiom/mnt/linux/autoload/topics.
   Loading /home/hemmecke/software/Axiom/mnt/linux/autoload/br-prof.
   Loading /home/hemmecke/software/Axiom/mnt/linux/autoload/br-saturn.
   CCDP is now explicitly exposed in frame frame0
   CCDP will be automatically loaded when needed from
      /home/hemmecke/scratch/Aistleitner/domcont
   CCDPC is now explicitly exposed in frame frame0
   CCDPC will be automatically loaded when needed from
      /home/hemmecke/scratch/Aistleitner/domcont
   CC is now explicitly exposed in frame frame0
   CC will be automatically loaded when needed from
      /home/hemmecke/scratch/Aistleitner/domcont
   Atom is now explicitly exposed in frame frame0
   Atom will be automatically loaded when needed from
      /home/hemmecke/scratch/Aistleitner/domcont
(1) -> ccdp(Atom, Atom);
   Loading /home/hemmecke/software/Axiom/mnt/linux/algebra/PRIMARR.o
      for domain PrimitiveArray

   >> System error:
   #<vector 094cbf18> is not of type LIST.





reply via email to

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