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

Edit detail for SandBox Aldor Semantics revision 2 of 5

1 2 3 4 5
Editor: 127.0.0.1
Time: 2007/11/11 11:37:39 GMT-8
Note: transferred from axiom-developer


        

The following Aldor code was given as an example by Ralf Hemmecke and added to the wiki by Martin Rubey. See the thread:

http://lists.gnu.org/archive/html/axiom-developer/2006-07/msg00046.html

aldor
#include "axiom"
define CatA: Category == with { }
define CatB: Category == with { }
define SomeCat: Category == with { CatA; CatB; }
Dom: SomeCat == Integer add;
A == Dom;
B: CatA == Dom;
H: CatA == Dom add;
main1():List Record(expression:String,result:Boolean) == [
  ["A has CatA",A has CatA],
  ["A has CatB",A has CatB],
  ["A has SomeCat",A has SomeCat],
  ["B has CatA",B has CatA],
  ["B has CatB",B has CatB],
  ["B has SomeCat",B has SomeCat],
  ["H has CatA",H has CatA],
  ["H has CatB",H has CatB],
  ["H has SomeCat",H has SomeCat]];
aldor
   Compiling FriCAS source code from file 
      /var/zope2/var/LatexWiki/3788028526442996283-25px001.as using 
      AXIOM-XL compiler and options 
-O -Fasy -Fao -Flsp -laxiom -Mno-ALDOR_W_WillObsolete -DAxiom -Y $AXIOM/algebra -I $AXIOM/algebra
      Use the system command )set compiler args to change these 
      options.
#1 (Warning) Could not use archive file `libaxiom.al'.
#2 (Warning) Could not use archive file `libaxiom.al'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 4: 
import from AxiomLib;
............^
[L4 C13] #3 (Error) No meaning for identifier `AxiomLib'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 15: import { true: %, false: % } from Boolean; ..................................^ [L15 C35] #4 (Error) No meaning for identifier `Boolean'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 17: string: Literal -> %; ........................^.......^ [L17 C25] #5 (Error) No meaning for identifier `Literal'. [L17 C33] #6 (Error) There are no suitable meanings for the operator `->'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 18: } from String; .......^ [L18 C8] #8 (Error) No meaning for identifier `String'.
"/var/zope2/var/LatexWiki/3788028526442996283-25px001.as", line 9: main1():List Record(expression:String,result:Boolean) == [ ........^....^.................^.............^ [L9 C9] #11 (Error) There are no suitable meanings for the operator `List'. [L9 C14] #12 (Error) There are no suitable meanings for the operator `Record'. [L9 C32] #10 (Error) No meaning for identifier `String'. [L9 C46] #9 (Error) No meaning for identifier `Boolean'. [L9 C46] #13 (Fatal Error) Too many errors (use `-M emax=n' or `-M no-emax' to change the limit).
The )library system command was not called after compilation.

You get...

axiom
main1()
There are no library operations named main1 Use HyperDoc Browse or issue )what op main1 to learn if there is any operation containing " main1 " in its name.
Cannot find a no-argument definition or library operation named main1 .
axiom
)clear completely
All user variables and function definitions have been cleared. All )browse facility databases have been cleared. Internally cached functions and constructors have been cleared. )clear completely is finished.

In particular, that "B has CatB?" is a bit surprising, isn't it?

Bill Page replied:

  I think you are dealing here with two separate but related issues:
  1) *static* typing, and 2) inheritance rules. All types in Aldor
  are static (or at least *nearly static*) meaning that they must be
  resolved during the compilation phase.

aldor
#include "axiom"
define CatA: Category == with; define CatB: Category == with; define CatX: Category == with {CatA; CatB;}
A: Join(CatX, CatA) == add; B: Join(CatX, CatB) == add; import from Integer; X: CatX == if odd? random(10) then A else B;
aldor
   Compiling FriCAS source code from file 
      /var/zope2/var/LatexWiki/934600477956551444-25px003.as using 
      AXIOM-XL compiler and options 
-O -Fasy -Fao -Flsp -laxiom -Mno-ALDOR_W_WillObsolete -DAxiom -Y $AXIOM/algebra -I $AXIOM/algebra
      Use the system command )set compiler args to change these 
      options.
#1 (Warning) Could not use archive file `libaxiom.al'.
#2 (Warning) Could not use archive file `libaxiom.al'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 4: 
import from AxiomLib;
............^
[L4 C13] #3 (Error) No meaning for identifier `AxiomLib'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 15: import { true: %, false: % } from Boolean; ..................................^ [L15 C35] #4 (Error) No meaning for identifier `Boolean'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 17: string: Literal -> %; ........................^.......^ [L17 C25] #5 (Error) No meaning for identifier `Literal'. [L17 C33] #6 (Error) There are no suitable meanings for the operator `->'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 18: } from String; .......^ [L18 C8] #8 (Error) No meaning for identifier `String'.
"/var/zope2/var/LatexWiki/934600477956551444-25px003.as", line 5: define CatX: Category == with {CatA; CatB;} .........................^ [L5 C26] #9 (Error) There are no suitable meanings for the operator `Join'.
"/var/zope2/var/LatexWiki/934600477956551444-25px003.as", line 7: A: Join(CatX, CatA) == add; ^ [L7 C1] #10 (Error) There are no suitable meanings for the operator `Join'.
"/var/zope2/var/LatexWiki/934600477956551444-25px003.as", line 8: B: Join(CatX, CatB) == add; ^ [L8 C1] #11 (Error) There are no suitable meanings for the operator `Join'.
"/var/zope2/var/LatexWiki/934600477956551444-25px003.as", line 9: import from Integer; ............^ [L9 C13] #12 (Error) No meaning for identifier `Integer'. [L9 C13] #13 (Fatal Error) Too many errors (use `-M emax=n' or `-M no-emax' to change the limit).
The )library system command was not called after compilation.

Try a little harder to create dynamic types:

aldor
#include "axiom"
import from Integer;
define CatA: Category == with {n:Integer}; define CatB: Category == with {n:Integer}; define CatX: Category == with {n:Integer};
A: Join(CatX, CatA) == add { n:Integer==1 }; B: Join(CatX, CatB) == add { n:Integer==2 }; X1: CatX == if odd? random(10) then (A add) else (B add); X2: CatX == if even? random(10) then (A add) else (B add);
aldor
   Compiling FriCAS source code from file 
      /var/zope2/var/LatexWiki/4046171615798297799-25px004.as using 
      AXIOM-XL compiler and options 
-O -Fasy -Fao -Flsp -laxiom -Mno-ALDOR_W_WillObsolete -DAxiom -Y $AXIOM/algebra -I $AXIOM/algebra
      Use the system command )set compiler args to change these 
      options.
#1 (Warning) Could not use archive file `libaxiom.al'.
#2 (Warning) Could not use archive file `libaxiom.al'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 4: 
import from AxiomLib;
............^
[L4 C13] #3 (Error) No meaning for identifier `AxiomLib'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 15: import { true: %, false: % } from Boolean; ..................................^ [L15 C35] #4 (Error) No meaning for identifier `Boolean'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 17: string: Literal -> %; ........................^.......^ [L17 C25] #5 (Error) No meaning for identifier `Literal'. [L17 C33] #6 (Error) There are no suitable meanings for the operator `->'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 18: } from String; .......^ [L18 C8] #8 (Error) No meaning for identifier `String'.
"/var/zope2/var/LatexWiki/4046171615798297799-25px004.as", line 3: import from Integer; ............^ [L3 C13] #9 (Error) No meaning for identifier `Integer'.
"/var/zope2/var/LatexWiki/4046171615798297799-25px004.as", line 6: define CatB: Category == with {n:Integer}; .................................^ [L6 C34] #11 (Error) No meaning for identifier `Integer'.
"/var/zope2/var/LatexWiki/4046171615798297799-25px004.as", line 7: define CatX: Category == with {n:Integer}; .................................^ [L7 C34] #10 (Error) No meaning for identifier `Integer'.
"/var/zope2/var/LatexWiki/4046171615798297799-25px004.as", line 10: B: Join(CatX, CatB) == add { n:Integer==2 }; ^ [L10 C1] #12 (Error) There are no suitable meanings for the operator `Join'. [L10 C1] #13 (Fatal Error) Too many errors (use `-M emax=n' or `-M no-emax' to change the limit).
The )library system command was not called after compilation.

axiom
for i in 1..10 repeat output [n()$X1,n()$X2]
X1 is not a valid type.
axiom
)clear completely
All user variables and function definitions have been cleared. All )browse facility databases have been cleared. Internally cached functions and constructors have been cleared. )clear completely is finished.

Or this way:

aldor
#include "axiom"
import from Integer;
define CatA: Category == with {n:Integer}; define CatB: Category == with {n:Integer}; define CatX: Category == with {CatA; CatB; n:Integer};
A: Join(CatX, CatA) == add { n:Integer==1 }; B: Join(CatX, CatB) == add { n:Integer==2 }; Y1: CatX == if odd? random(10) then A else B; Y2: CatX == if even? random(10) then A else B;
aldor
   Compiling FriCAS source code from file 
      /var/zope2/var/LatexWiki/3471379723332304579-25px006.as using 
      AXIOM-XL compiler and options 
-O -Fasy -Fao -Flsp -laxiom -Mno-ALDOR_W_WillObsolete -DAxiom -Y $AXIOM/algebra -I $AXIOM/algebra
      Use the system command )set compiler args to change these 
      options.
#1 (Warning) Could not use archive file `libaxiom.al'.
#2 (Warning) Could not use archive file `libaxiom.al'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 4: 
import from AxiomLib;
............^
[L4 C13] #3 (Error) No meaning for identifier `AxiomLib'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 15: import { true: %, false: % } from Boolean; ..................................^ [L15 C35] #4 (Error) No meaning for identifier `Boolean'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 17: string: Literal -> %; ........................^.......^ [L17 C25] #5 (Error) No meaning for identifier `Literal'. [L17 C33] #6 (Error) There are no suitable meanings for the operator `->'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 18: } from String; .......^ [L18 C8] #8 (Error) No meaning for identifier `String'.
"/var/zope2/var/LatexWiki/3471379723332304579-25px006.as", line 2: import from Integer; ............^ [L2 C13] #9 (Error) No meaning for identifier `Integer'.
"/var/zope2/var/LatexWiki/3471379723332304579-25px006.as", line 4: define CatA: Category == with {n:Integer}; .................................^ [L4 C34] #11 (Error) No meaning for identifier `Integer'.
"/var/zope2/var/LatexWiki/3471379723332304579-25px006.as", line 5: define CatB: Category == with {n:Integer}; .................................^ [L5 C34] #10 (Error) No meaning for identifier `Integer'.
"/var/zope2/var/LatexWiki/3471379723332304579-25px006.as", line 6: define CatX: Category == with {CatA; CatB; n:Integer}; .............................................^ [L6 C46] #12 (Error) No meaning for identifier `Integer'. [L6 C46] #13 (Fatal Error) Too many errors (use `-M emax=n' or `-M no-emax' to change the limit).
The )library system command was not called after compilation.

axiom
for i in 1..10 repeat output [n()$Y1,n()$Y2]
Y1 is not a valid type.
axiom
)clear completely
All user variables and function definitions have been cleared. All )browse facility databases have been cleared. Internally cached functions and constructors have been cleared. )clear completely is finished.

Or like this:

aldor
#include "axiom"
import from Integer;
define CatX: Category == with {foo: () -> Integer}
A: CatX == add {foo(): Integer == 0;}
B: CatX == add {foo(): Integer == 1;}
Z: CatX == if odd? random(10) then A else B;
aldor
   Compiling FriCAS source code from file 
      /var/zope2/var/LatexWiki/5702025508533234167-25px008.as using 
      AXIOM-XL compiler and options 
-O -Fasy -Fao -Flsp -laxiom -Mno-ALDOR_W_WillObsolete -DAxiom -Y $AXIOM/algebra -I $AXIOM/algebra
      Use the system command )set compiler args to change these 
      options.
#1 (Warning) Could not use archive file `libaxiom.al'.
#2 (Warning) Could not use archive file `libaxiom.al'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 4: 
import from AxiomLib;
............^
[L4 C13] #3 (Error) No meaning for identifier `AxiomLib'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 15: import { true: %, false: % } from Boolean; ..................................^ [L15 C35] #4 (Error) No meaning for identifier `Boolean'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 17: string: Literal -> %; ........................^.......^ [L17 C25] #5 (Error) No meaning for identifier `Literal'. [L17 C33] #6 (Error) There are no suitable meanings for the operator `->'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 18: } from String; .......^ [L18 C8] #8 (Error) No meaning for identifier `String'.
"/var/zope2/var/LatexWiki/5702025508533234167-25px008.as", line 2: import from Integer; ............^ [L2 C13] #9 (Error) No meaning for identifier `Integer'.
"/var/zope2/var/LatexWiki/5702025508533234167-25px008.as", line 3: define CatX: Category == with {foo: () -> Integer} .......................................^..^ [L3 C40] #11 (Error) There are no suitable meanings for the operator `->'. [L3 C43] #10 (Error) No meaning for identifier `Integer'. [L3 C43] #13 (Fatal Error) Too many errors (use `-M emax=n' or `-M no-emax' to change the limit).
The )library system command was not called after compilation.

axiom
for i in 1..10 repeat output foo()$Z
Z is not a valid type.
axiom
)clear completely
All user variables and function definitions have been cleared. All )browse facility databases have been cleared. Internally cached functions and constructors have been cleared. )clear completely is finished.

Ralf Hemmecke asked: Why does the compiler reject the program without the "add" in line (*)?

aldor
#include "axiom"
define CatA: Category == with; define CatB: Category == with; define CatX: Category == with; A: CatX with { CatA } == add; B: CatX with { CatB } == add; X: CatX == if true then (A add) else (B add); -- (*)
main2():List Record(expression:String,result:Boolean) == [ ["X has CatA",X has CatA], ["X has CatB",X has CatB], ["X has CatX",X has CatX]];
aldor
   Compiling FriCAS source code from file 
      /var/zope2/var/LatexWiki/7712043450922662837-25px010.as using 
      AXIOM-XL compiler and options 
-O -Fasy -Fao -Flsp -laxiom -Mno-ALDOR_W_WillObsolete -DAxiom -Y $AXIOM/algebra -I $AXIOM/algebra
      Use the system command )set compiler args to change these 
      options.
#1 (Warning) Could not use archive file `libaxiom.al'.
#2 (Warning) Could not use archive file `libaxiom.al'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 4: 
import from AxiomLib;
............^
[L4 C13] #3 (Error) No meaning for identifier `AxiomLib'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 15: import { true: %, false: % } from Boolean; ..................................^ [L15 C35] #4 (Error) No meaning for identifier `Boolean'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 17: string: Literal -> %; ........................^.......^ [L17 C25] #5 (Error) No meaning for identifier `Literal'. [L17 C33] #6 (Error) There are no suitable meanings for the operator `->'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 18: } from String; .......^ [L18 C8] #8 (Error) No meaning for identifier `String'.
"/var/zope2/var/LatexWiki/7712043450922662837-25px010.as", line 10: main2():List Record(expression:String,result:Boolean) == [ ........^....^.................^.............^ [L10 C9] #11 (Error) There are no suitable meanings for the operator `List'. [L10 C14] #12 (Error) There are no suitable meanings for the operator `Record'. [L10 C32] #10 (Error) No meaning for identifier `String'. [L10 C46] #9 (Error) No meaning for identifier `Boolean'. [L10 C46] #13 (Fatal Error) Too many errors (use `-M emax=n' or `-M no-emax' to change the limit).
The )library system command was not called after compilation.

axiom
main2()
There are no library operations named main2 Use HyperDoc Browse or issue )what op main2 to learn if there is any operation containing " main2 " in its name.
Cannot find a no-argument definition or library operation named main2 .
axiom
)clear completely
All user variables and function definitions have been cleared. All )browse facility databases have been cleared. Internally cached functions and constructors have been cleared. )clear completely is finished.

Christian Aistleitner provided this answer:

I'd consider that a bug in comparison of exports. Replacing your (*) line by:

   X: CatX == if true then (A@CatX) else (B@CatX);

gives a working program.

aldor
#include "axiom"
define CatA: Category == with; define CatB: Category == with; define CatX: Category == with; A: CatX with { CatA } == add; B: CatX with { CatB } == add; X: CatX == if true then A@CatX else B@CatX; -- (*)
main3():List Record(expression:String,result:Boolean) == [ ["X has CatA",X has CatA], ["X has CatB",X has CatB], ["X has CatX",X has CatX]];
aldor
   Compiling FriCAS source code from file 
      /var/zope2/var/LatexWiki/1208324321343406004-25px012.as using 
      AXIOM-XL compiler and options 
-O -Fasy -Fao -Flsp -laxiom -Mno-ALDOR_W_WillObsolete -DAxiom -Y $AXIOM/algebra -I $AXIOM/algebra
      Use the system command )set compiler args to change these 
      options.
#1 (Warning) Could not use archive file `libaxiom.al'.
#2 (Warning) Could not use archive file `libaxiom.al'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 4: 
import from AxiomLib;
............^
[L4 C13] #3 (Error) No meaning for identifier `AxiomLib'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 15: import { true: %, false: % } from Boolean; ..................................^ [L15 C35] #4 (Error) No meaning for identifier `Boolean'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 17: string: Literal -> %; ........................^.......^ [L17 C25] #5 (Error) No meaning for identifier `Literal'. [L17 C33] #6 (Error) There are no suitable meanings for the operator `->'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 18: } from String; .......^ [L18 C8] #8 (Error) No meaning for identifier `String'.
"/var/zope2/var/LatexWiki/1208324321343406004-25px012.as", line 10: main3():List Record(expression:String,result:Boolean) == [ ........^....^.................^.............^ [L10 C9] #11 (Error) There are no suitable meanings for the operator `List'. [L10 C14] #12 (Error) There are no suitable meanings for the operator `Record'. [L10 C32] #10 (Error) No meaning for identifier `String'. [L10 C46] #9 (Error) No meaning for identifier `Boolean'. [L10 C46] #13 (Fatal Error) Too many errors (use `-M emax=n' or `-M no-emax' to change the limit).
The )library system command was not called after compilation.

axiom
main3()
There are no library operations named main3 Use HyperDoc Browse or issue )what op main3 to learn if there is any operation containing " main3 " in its name.
Cannot find a no-argument definition or library operation named main3 .
axiom
)clear completely
All user variables and function definitions have been cleared. All )browse facility databases have been cleared. Internally cached functions and constructors have been cleared. )clear completely is finished.

So the problem (wild guess) is that the compiler Has problems with seeing that the if statement gives CatX? in both branches of the if statement. Mainly because the types of A and B aro not equal. However, you can hint the compiler. My code is telling him "The if part gives CatX? and the else part gives CatX?". Then the compiler can infer, that the whole "if" statement gives CatX?. And it is at least the type of X (which is CatX?). So it matches.

aldor
#include "axiom"
import from Integer;
define CatA: Category == with;
define CatB: Category == with;
define CatX: Category == with;
A: Join(CatX, CatA) == add;
B: Join(CatX, CatB) == add;
MyPkg(X: CatX): with {isA?: () -> Boolean} == add { isA?(): Boolean == X has CatA; } main4(n:Integer): Boolean == { X: CatX == if zero? n then (A@CatX) else (B@CatX); isA?()$MyPkg(X); }
aldor
   Compiling FriCAS source code from file 
      /var/zope2/var/LatexWiki/6804229532583544981-25px014.as using 
      AXIOM-XL compiler and options 
-O -Fasy -Fao -Flsp -laxiom -Mno-ALDOR_W_WillObsolete -DAxiom -Y $AXIOM/algebra -I $AXIOM/algebra
      Use the system command )set compiler args to change these 
      options.
#1 (Warning) Could not use archive file `libaxiom.al'.
#2 (Warning) Could not use archive file `libaxiom.al'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 4: 
import from AxiomLib;
............^
[L4 C13] #3 (Error) No meaning for identifier `AxiomLib'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 15: import { true: %, false: % } from Boolean; ..................................^ [L15 C35] #4 (Error) No meaning for identifier `Boolean'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 17: string: Literal -> %; ........................^.......^ [L17 C25] #5 (Error) No meaning for identifier `Literal'. [L17 C33] #6 (Error) There are no suitable meanings for the operator `->'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 18: } from String; .......^ [L18 C8] #8 (Error) No meaning for identifier `String'.
"/var/zope2/var/LatexWiki/6804229532583544981-25px014.as", line 2: import from Integer; ............^ [L2 C13] #9 (Error) No meaning for identifier `Integer'.
"/var/zope2/var/LatexWiki/6804229532583544981-25px014.as", line 12: main4(n:Integer): Boolean == { ......^.^.........^ [L12 C7] #12 (Error) There are no suitable meanings for the operator `->'. [L12 C9] #10 (Error) No meaning for identifier `Integer'. [L12 C19] #11 (Error) No meaning for identifier `Boolean'. [L12 C19] #13 (Fatal Error) Too many errors (use `-M emax=n' or `-M no-emax' to change the limit).
The )library system command was not called after compilation.

axiom
main4(0)
There are no library operations named main4 Use HyperDoc Browse or issue )what op main4 to learn if there is any operation containing " main4 " in its name.
Cannot find a definition or applicable library operation named main4 with argument type(s) NonNegativeInteger
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. main4(1)
There are no library operations named main4 Use HyperDoc Browse or issue )what op main4 to learn if there is any operation containing " main4 " in its name.
Cannot find a definition or applicable library operation named main4 with argument type(s) PositiveInteger
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need.
axiom
)clear completely
All user variables and function definitions have been cleared. All )browse facility databases have been cleared. Internally cached functions and constructors have been cleared. )clear completely is finished.

In the following code we have the correspondence:

    A      <--> B
    String <--> with
    "x"    <--> String
    "y"    <--> Integer

aldor
#include "axiom"
define CatA(s: String): Category == with;
A(s: String): CatA(s) == add;
define CatB(s: with): Category == with; B(s: with): CatB(s) == add;
rhxmain(): List Record(s: String, b: Boolean) == [ ["A x has CatA x", (A("x") has CatA("x"))], ["A y has CatA x", (A("y") has CatA("x"))], ["B String has CatB String", (B(String) has CatB(String))], ["B Integer has CatB String",(B(Integer) has CatB(String))] ];
aldor
   Compiling FriCAS source code from file 
      /var/zope2/var/LatexWiki/7724360379013079758-25px016.as using 
      AXIOM-XL compiler and options 
-O -Fasy -Fao -Flsp -laxiom -Mno-ALDOR_W_WillObsolete -DAxiom -Y $AXIOM/algebra -I $AXIOM/algebra
      Use the system command )set compiler args to change these 
      options.
#1 (Warning) Could not use archive file `libaxiom.al'.
#2 (Warning) Could not use archive file `libaxiom.al'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 4: 
import from AxiomLib;
............^
[L4 C13] #3 (Error) No meaning for identifier `AxiomLib'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 15: import { true: %, false: % } from Boolean; ..................................^ [L15 C35] #4 (Error) No meaning for identifier `Boolean'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 17: string: Literal -> %; ........................^.......^ [L17 C25] #5 (Error) No meaning for identifier `Literal'. [L17 C33] #6 (Error) There are no suitable meanings for the operator `->'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 18: } from String; .......^ [L18 C8] #8 (Error) No meaning for identifier `String'.
"/var/zope2/var/LatexWiki/7724360379013079758-25px016.as", line 8: rhxmain(): List Record(s: String, b: Boolean) == [ ...........^....^.........^..........^ [L8 C12] #11 (Error) There are no suitable meanings for the operator `List'. [L8 C17] #12 (Error) There are no suitable meanings for the operator `Record'. [L8 C27] #10 (Error) No meaning for identifier `String'. [L8 C38] #9 (Error) No meaning for identifier `Boolean'. [L8 C38] #13 (Fatal Error) Too many errors (use `-M emax=n' or `-M no-emax' to change the limit).
The )library system command was not called after compilation.

The interesting part is that the truth value of the second and fourth list elements do not agree.

axiom
rhxmain()
There are no library operations named rhxmain Use HyperDoc Browse or issue )what op rhxmain to learn if there is any operation containing " rhxmain " in its name.
Cannot find a no-argument definition or library operation named rhxmain .
axiom
)clear completely
All user variables and function definitions have been cleared. All )browse facility databases have been cleared. Internally cached functions and constructors have been cleared. )clear completely is finished.

An example of a domain-valued variable

#include "axiom"
#pile
main5(n:Integer):List Boolean == local x:IntegralDomain local y:Category
if n=1 then y := Field else y := Ring
x := Integer test1:Boolean := x has y x := Fraction Integer test2:Boolean := x has y [test1,test2]
aldor
   Compiling FriCAS source code from file 
      /var/zope2/var/LatexWiki/1586618870818532942-25px018.as using 
      AXIOM-XL compiler and options 
-O -Fasy -Fao -Flsp -laxiom -Mno-ALDOR_W_WillObsolete -DAxiom -Y $AXIOM/algebra -I $AXIOM/algebra
      Use the system command )set compiler args to change these 
      options.
#1 (Warning) Could not use archive file `libaxiom.al'.
#2 (Warning) Could not use archive file `libaxiom.al'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 4: 
import from AxiomLib;
............^
[L4 C13] #3 (Error) No meaning for identifier `AxiomLib'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 15: import { true: %, false: % } from Boolean; ..................................^ [L15 C35] #4 (Error) No meaning for identifier `Boolean'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 17: string: Literal -> %; ........................^.......^ [L17 C25] #5 (Error) No meaning for identifier `Literal'. [L17 C33] #6 (Error) There are no suitable meanings for the operator `->'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 18: } from String; .......^ [L18 C8] #8 (Error) No meaning for identifier `String'.
"/var/zope2/var/LatexWiki/1586618870818532942-25px018.as", line 4: main5(n:Integer):List Boolean == ......^.^........^....^ [L4 C7] #12 (Error) There are no suitable meanings for the operator `->'. [L4 C9] #9 (Error) No meaning for identifier `Integer'. [L4 C18] #10 (Error) There are no suitable meanings for the operator `List'. [L4 C23] #11 (Error) No meaning for identifier `Boolean'. [L4 C23] #13 (Fatal Error) Too many errors (use `-M emax=n' or `-M no-emax' to change the limit).
The )library system command was not called after compilation.

axiom
main5(1)
There are no library operations named main5 Use HyperDoc Browse or issue )what op main5 to learn if there is any operation containing " main5 " in its name.
Cannot find a definition or applicable library operation named main5 with argument type(s) PositiveInteger
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. main5(2)
There are no library operations named main5 Use HyperDoc Browse or issue )what op main5 to learn if there is any operation containing " main5 " in its name.
Cannot find a definition or applicable library operation named main5 with argument type(s) PositiveInteger
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need.
axiom
)clear completely
All user variables and function definitions have been cleared. All )browse facility databases have been cleared. Internally cached functions and constructors have been cleared. )clear completely is finished.

The compiler checks static types.

aldor
#include "axiom"
#pile
main6():List Boolean == local x:IntegralDomain
x := Integer test1:Boolean := x has Field x := String test2:Boolean := x has Field [test1,test2]
aldor
   Compiling FriCAS source code from file 
      /var/zope2/var/LatexWiki/395909315557564304-25px020.as using 
      AXIOM-XL compiler and options 
-O -Fasy -Fao -Flsp -laxiom -Mno-ALDOR_W_WillObsolete -DAxiom -Y $AXIOM/algebra -I $AXIOM/algebra
      Use the system command )set compiler args to change these 
      options.
#1 (Warning) Could not use archive file `libaxiom.al'.
#2 (Warning) Could not use archive file `libaxiom.al'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 4: 
import from AxiomLib;
............^
[L4 C13] #3 (Error) No meaning for identifier `AxiomLib'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 15: import { true: %, false: % } from Boolean; ..................................^ [L15 C35] #4 (Error) No meaning for identifier `Boolean'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 17: string: Literal -> %; ........................^.......^ [L17 C25] #5 (Error) No meaning for identifier `Literal'. [L17 C33] #6 (Error) There are no suitable meanings for the operator `->'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 18: } from String; .......^ [L18 C8] #8 (Error) No meaning for identifier `String'.
"/var/zope2/var/LatexWiki/395909315557564304-25px020.as", line 4: main6():List Boolean == ^.......^....^ [L4 C1] #11 (Error) There are no suitable meanings for the operator `->'. [L4 C9] #9 (Error) There are no suitable meanings for the operator `List'. [L4 C14] #10 (Error) No meaning for identifier `Boolean'. [L4 C14] #13 (Fatal Error) Too many errors (use `-M emax=n' or `-M no-emax' to change the limit).
The )library system command was not called after compilation.

But note that we cannot define domain-valued variables in the Axiom interpreter.

axiom
x:IntegralDomain
IntegralDomain is a category, not a domain, and declarations require domains.

Try to write a self-describing domain --Bill Page, Wed, 26 Jul 2006 06:28:37 -0500 reply
aldor
#include "axiom"
#pile
MyDom: with sigs:List Category add2:(MyDom,MyDom) -> MyDom sub2:(MyDom,MyDom) -> MyDom neg: MyDom -> MyDom == add import from Integer Rep == Integer
sigs:List Category == [with {add2:(MyDom,MyDom)->MyDom}, with {sub2:(MyDom,MyDom)->MyDom}, with {neg:MyDom->MyDom}]
add2(x:%,y:%):% == per(rep(x) + rep(y)) sub2(x:%,y:%):% == per(rep(x) - rep(y)) neg(x:%):% == per(-rep(x))
main8():List Boolean == import from ListFunctions2(Category,Boolean)
map((i:Category):Boolean+->(MyDom has i), sigs$MyDom)
aldor
   Compiling FriCAS source code from file 
      /var/zope2/var/LatexWiki/7325620604487185069-25px022.as using 
      AXIOM-XL compiler and options 
-O -Fasy -Fao -Flsp -laxiom -Mno-ALDOR_W_WillObsolete -DAxiom -Y $AXIOM/algebra -I $AXIOM/algebra
      Use the system command )set compiler args to change these 
      options.
#1 (Warning) Could not use archive file `libaxiom.al'.
#2 (Warning) Could not use archive file `libaxiom.al'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 4: 
import from AxiomLib;
............^
[L4 C13] #3 (Error) No meaning for identifier `AxiomLib'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 15: import { true: %, false: % } from Boolean; ..................................^ [L15 C35] #4 (Error) No meaning for identifier `Boolean'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 17: string: Literal -> %; ........................^.......^ [L17 C25] #5 (Error) No meaning for identifier `Literal'. [L17 C33] #6 (Error) There are no suitable meanings for the operator `->'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as", line 18: } from String; .......^ [L18 C8] #8 (Error) No meaning for identifier `String'.
"/var/zope2/var/LatexWiki/7325620604487185069-25px022.as", line 22: main8():List Boolean == ^.......^....^ [L22 C1] #11 (Error) There are no suitable meanings for the operator `->'. [L22 C9] #9 (Error) There are no suitable meanings for the operator `List'. [L22 C14] #10 (Error) No meaning for identifier `Boolean'. [L22 C14] #13 (Fatal Error) Too many errors (use `-M emax=n' or `-M no-emax' to change the limit).
The )library system command was not called after compilation.

axiom
)sh MyDom
The )show system command is used to display information about types or partial types. For example, )show Integer will show information about Integer .
MyDom is not the name of a known type constructor. If you want to see information about any operations named MyDom , issue )display operations MyDom main8()
There are no library operations named main8 Use HyperDoc Browse or issue )what op main8 to learn if there is any operation containing " main8 " in its name.
Cannot find a no-argument definition or library operation named main8 .