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 fricas )version 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, aldor Compiling FriCAS source code from file /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/3788028526442996283-25px002.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. The )library system command was not called after compilation. You get... fricas main1() 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" aldor Compiling FriCAS source code from file /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/934600477956551444-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. The )library system command was not called after compilation. Try a little harder to create dynamic types: aldor #include "axiom" aldor Compiling FriCAS source code from file /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/4046171615798297799-25px005.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. The )library system command was not called after compilation. fricas for i in 1..10 repeat output [n()$X1, Or this way: aldor #include "axiom" import from Integer; aldor Compiling FriCAS source code from file /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/3471379723332304579-25px007.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. The )library system command was not called after compilation. fricas for i in 1..10 repeat output [n()$Y1, 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/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/5702025508533234167-25px009.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. The )library system command was not called after compilation. fricas for i in 1..10 repeat output foo()$Z Ralf Hemmecke asked: Why does the compiler reject the program without the "add" in line (*)? aldor #include "axiom" aldor Compiling FriCAS source code from file /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/7712043450922662837-25px011.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. The )library system command was not called after compilation. fricas main2() 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" aldor Compiling FriCAS source code from file /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/1208324321343406004-25px013.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. The )library system command was not called after compilation. fricas main3() 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, aldor Compiling FriCAS source code from file /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/6804229532583544981-25px015.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. The )library system command was not called after compilation. fricas main4(0) 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; aldor Compiling FriCAS source code from file /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/7724360379013079758-25px017.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. 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. fricas rhxmain() An example of a domain-valued variable #include "axiom" #pile aldor Compiling FriCAS source code from file /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/1586618870818532942-25px019.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. The )library system command was not called after compilation. fricas main5(1) The compiler checks static types. aldor #include "axiom" #pile aldor Compiling FriCAS source code from file /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/395909315557564304-25px021.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. The )library system command was not called after compilation. But note that we cannot define domain-valued variables in the Axiom interpreter. fricas x:IntegralDomain aldor #include "axiom" #pile aldor Compiling FriCAS source code from file /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/7325620604487185069-25px023.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. The )library system command was not called after compilation. fricas )sh MyDom |

Try to write a self-describing domain--Bill Page, Wed, 26 Jul 2006 06:28:37 -0500 reply