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

Edit detail for SandBox Aldor Semantics revision 5 of 5

1 2 3 4 5
Editor: test1
Time: 2023/09/17 16:00:14 GMT+0
Note:

changed:
-#include "axiom"
#include "fricas"

changed:
-#include "axiom"
#include "fricas"

changed:
-#include "axiom"
-
-import from Integer;
#include "fricas"

import from Integer;

changed:
-#include "axiom"
-import from Integer;
#include "fricas"
import from Integer;

changed:
-#include "axiom"
#include "fricas"

changed:
-#include "axiom"
#include "fricas"

changed:
-#include "axiom"
#include "fricas"

changed:
-#include "axiom"
#include "fricas"

changed:
-#include "axiom"
#include "fricas"

changed:
-#include "axiom"
#include "fricas"

changed:
-#include "axiom"
#include "fricas"

changed:
-the Axiom interpreter.
the FriCAS interpreter.

changed:
-#include "axiom"
#include "fricas"

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
(1) -> )version
"FriCAS 1.3.10 compiled at Wed 10 Jan 02:19:45 CET 2024"

aldor
#include "fricas"
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/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/2635879875939783572-25px002.as
      using Aldor compiler and options 
-O -Fasy -Fao -Flsp -lfricas -Mno-ALDOR_W_WillObsolete -DFriCAS -Y $FRICAS/algebra -I $FRICAS/algebra
      Use the system command )set compiler args to change these 
      options.
   Compiling Lisp source code from file 
      ./2635879875939783572-25px002.lsp
   Issuing )library command for 2635879875939783572-25px002
   Reading /var/aw/var/LatexWiki/2635879875939783572-25px002.asy
   CatA is now explicitly exposed in frame initial 
   CatA will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/2635879875939783572-25px002
   CatB is now explicitly exposed in frame initial 
   CatB will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/2635879875939783572-25px002
   SomeCat is now explicitly exposed in frame initial 
   SomeCat will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/2635879875939783572-25px002
   Dom is now explicitly exposed in frame initial 
   Dom will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/2635879875939783572-25px002
   A is now explicitly exposed in frame initial 
   A will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/2635879875939783572-25px002
   B is now explicitly exposed in frame initial 
   B will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/2635879875939783572-25px002
   H is now explicitly exposed in frame initial 
   H will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/2635879875939783572-25px002

You get...

fricas
main1()

\label{eq1}\begin{array}{@{}l}
\displaystyle
\left[{\left[{expression = \verb#"A has CatA"#}, \:{result =  \mbox{\rm true} }\right]}, \: \right.
\
\
\displaystyle
\left.{\left[{expression = \verb#"A has CatB"#}, \:{result =  \mbox{\rm true} }\right]}, \: \right.
\
\
\displaystyle
\left.{\left[{expression = \verb#"A has SomeCat"#}, \:{result =  \mbox{\rm true} }\right]}, \: \right.
\
\
\displaystyle
\left.{\left[{expression = \verb#"B has CatA"#}, \:{result =  \mbox{\rm true} }\right]}, \: \right.
\
\
\displaystyle
\left.{\left[{expression = \verb#"B has CatB"#}, \:{result =  \mbox{\rm true} }\right]}, \: \right.
\
\
\displaystyle
\left.{\left[{expression = \verb#"B has SomeCat"#}, \:{result =  \mbox{\rm true} }\right]}, \: \right.
\
\
\displaystyle
\left.{\left[{expression = \verb#"H has CatA"#}, \:{result =  \mbox{\rm true} }\right]}, \: \right.
\
\
\displaystyle
\left.{\left[{expression = \verb#"H has CatB"#}, \:{result =  \mbox{\rm false} }\right]}, \: \right.
\
\
\displaystyle
\left.{\left[{expression = \verb#"H has SomeCat"#}, \:{result =  \mbox{\rm false} }\right]}\right] 
(1)
Type: List(Record(expression: String,result: Boolean))
fricas
)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 "fricas"
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/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/551345834211954051-25px004.as
      using Aldor compiler and options 
-O -Fasy -Fao -Flsp -lfricas -Mno-ALDOR_W_WillObsolete -DFriCAS -Y $FRICAS/algebra -I $FRICAS/algebra
      Use the system command )set compiler args to change these 
      options.
   Compiling Lisp source code from file 
      ./551345834211954051-25px004.lsp
   Issuing )library command for 551345834211954051-25px004
   Reading /var/aw/var/LatexWiki/551345834211954051-25px004.asy
   CatA is now explicitly exposed in frame initial 
   CatA will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/551345834211954051-25px004
   CatB is now explicitly exposed in frame initial 
   CatB will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/551345834211954051-25px004
   CatX is now explicitly exposed in frame initial 
   CatX will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/551345834211954051-25px004
   A is now explicitly exposed in frame initial 
   A will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/551345834211954051-25px004
   B is now explicitly exposed in frame initial 
   B will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/551345834211954051-25px004
   X is now explicitly exposed in frame initial 
   X will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/551345834211954051-25px004

Try a little harder to create dynamic types:

aldor
#include "fricas"
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/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/1438580684530002070-25px005.as
      using Aldor compiler and options 
-O -Fasy -Fao -Flsp -lfricas -Mno-ALDOR_W_WillObsolete -DFriCAS -Y $FRICAS/algebra -I $FRICAS/algebra
      Use the system command )set compiler args to change these 
      options.
   Compiling Lisp source code from file 
      ./1438580684530002070-25px005.lsp
   Issuing )library command for 1438580684530002070-25px005
   Reading /var/aw/var/LatexWiki/1438580684530002070-25px005.asy
   CatA is already explicitly exposed in frame initial 
   CatA will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/1438580684530002070-25px005
   CatB is already explicitly exposed in frame initial 
   CatB will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/1438580684530002070-25px005
   CatX is already explicitly exposed in frame initial 
   CatX will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/1438580684530002070-25px005
   A is already explicitly exposed in frame initial 
   A will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/1438580684530002070-25px005
   B is already explicitly exposed in frame initial 
   B will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/1438580684530002070-25px005
   X1 is now explicitly exposed in frame initial 
   X1 will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/1438580684530002070-25px005
   X2 is now explicitly exposed in frame initial 
   X2 will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/1438580684530002070-25px005

fricas
for i in 1..10 repeat output [n()$X1,n()$X2]
[2, 2] [2, 2] [2, 2] [2, 2] [2, 2] [2, 2] [2, 2] [2, 2] [2, 2] [2, 2]
Type: Void
fricas
)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 "fricas"
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/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/5501580183423487024-25px007.as
      using Aldor compiler and options 
-O -Fasy -Fao -Flsp -lfricas -Mno-ALDOR_W_WillObsolete -DFriCAS -Y $FRICAS/algebra -I $FRICAS/algebra
      Use the system command )set compiler args to change these 
      options.
   Compiling Lisp source code from file 
      ./5501580183423487024-25px007.lsp
   Issuing )library command for 5501580183423487024-25px007
   Reading /var/aw/var/LatexWiki/5501580183423487024-25px007.asy
   CatA is now explicitly exposed in frame initial 
   CatA will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/5501580183423487024-25px007
   CatB is now explicitly exposed in frame initial 
   CatB will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/5501580183423487024-25px007
   CatX is now explicitly exposed in frame initial 
   CatX will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/5501580183423487024-25px007
   A is now explicitly exposed in frame initial 
   A will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/5501580183423487024-25px007
   B is now explicitly exposed in frame initial 
   B will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/5501580183423487024-25px007
   Y1 is now explicitly exposed in frame initial 
   Y1 will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/5501580183423487024-25px007
   Y2 is now explicitly exposed in frame initial 
   Y2 will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/5501580183423487024-25px007

fricas
for i in 1..10 repeat output [n()$Y1,n()$Y2]
[1, 2] [1, 2] [1, 2] [1, 2] [1, 2] [1, 2] [1, 2] [1, 2] [1, 2] [1, 2]
Type: Void
fricas
)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 "fricas"
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/4475696461483594624-25px009.as
      using Aldor compiler and options 
-O -Fasy -Fao -Flsp -lfricas -Mno-ALDOR_W_WillObsolete -DFriCAS -Y $FRICAS/algebra -I $FRICAS/algebra
      Use the system command )set compiler args to change these 
      options.
   Compiling Lisp source code from file 
      ./4475696461483594624-25px009.lsp
   Issuing )library command for 4475696461483594624-25px009
   Reading /var/aw/var/LatexWiki/4475696461483594624-25px009.asy
   CatX is now explicitly exposed in frame initial 
   CatX will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/4475696461483594624-25px009
   A is now explicitly exposed in frame initial 
   A will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/4475696461483594624-25px009
   B is now explicitly exposed in frame initial 
   B will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/4475696461483594624-25px009
   Z is now explicitly exposed in frame initial 
   Z will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/4475696461483594624-25px009

fricas
for i in 1..10 repeat output foo()$Z
0 0 0 0 0 0 0 0 0 0
Type: Void
fricas
)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 "fricas"
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/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/731070323520525114-25px011.as
      using Aldor compiler and options 
-O -Fasy -Fao -Flsp -lfricas -Mno-ALDOR_W_WillObsolete -DFriCAS -Y $FRICAS/algebra -I $FRICAS/algebra
      Use the system command )set compiler args to change these 
      options.
   Compiling Lisp source code from file 
      ./731070323520525114-25px011.lsp
   Issuing )library command for 731070323520525114-25px011
   Reading /var/aw/var/LatexWiki/731070323520525114-25px011.asy
   CatA is now explicitly exposed in frame initial 
   CatA will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/731070323520525114-25px011
   CatB is now explicitly exposed in frame initial 
   CatB will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/731070323520525114-25px011
   CatX is now explicitly exposed in frame initial 
   CatX will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/731070323520525114-25px011
   A is now explicitly exposed in frame initial 
   A will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/731070323520525114-25px011
   B is now explicitly exposed in frame initial 
   B will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/731070323520525114-25px011
   X is now explicitly exposed in frame initial 
   X will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/731070323520525114-25px011

fricas
main2()

\label{eq2}\begin{array}{@{}l}
\displaystyle
\left[{\left[{expression = \verb#"X has CatA"#}, \:{result =  \mbox{\rm false} }\right]}, \: \right.
\
\
\displaystyle
\left.{\left[{expression = \verb#"X has CatB"#}, \:{result =  \mbox{\rm false} }\right]}, \: \right.
\
\
\displaystyle
\left.{\left[{expression = \verb#"X has CatX"#}, \:{result =  \mbox{\rm true} }\right]}\right] 
(2)
Type: List(Record(expression: String,result: Boolean))
fricas
)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 "fricas"
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/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/2725589955460952637-25px013.as
      using Aldor compiler and options 
-O -Fasy -Fao -Flsp -lfricas -Mno-ALDOR_W_WillObsolete -DFriCAS -Y $FRICAS/algebra -I $FRICAS/algebra
      Use the system command )set compiler args to change these 
      options.
   Compiling Lisp source code from file 
      ./2725589955460952637-25px013.lsp
   Issuing )library command for 2725589955460952637-25px013
   Reading /var/aw/var/LatexWiki/2725589955460952637-25px013.asy
   CatA is now explicitly exposed in frame initial 
   CatA will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/2725589955460952637-25px013
   CatB is now explicitly exposed in frame initial 
   CatB will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/2725589955460952637-25px013
   CatX is now explicitly exposed in frame initial 
   CatX will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/2725589955460952637-25px013
   A is now explicitly exposed in frame initial 
   A will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/2725589955460952637-25px013
   B is now explicitly exposed in frame initial 
   B will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/2725589955460952637-25px013
   X is now explicitly exposed in frame initial 
   X will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/2725589955460952637-25px013

fricas
main3()

\label{eq3}\begin{array}{@{}l}
\displaystyle
\left[{\left[{expression = \verb#"X has CatA"#}, \:{result =  \mbox{\rm true} }\right]}, \: \right.
\
\
\displaystyle
\left.{\left[{expression = \verb#"X has CatB"#}, \:{result =  \mbox{\rm false} }\right]}, \: \right.
\
\
\displaystyle
\left.{\left[{expression = \verb#"X has CatX"#}, \:{result =  \mbox{\rm true} }\right]}\right] 
(3)
Type: List(Record(expression: String,result: Boolean))
fricas
)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 "fricas"
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/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/3499552379206056026-25px015.as
      using Aldor compiler and options 
-O -Fasy -Fao -Flsp -lfricas -Mno-ALDOR_W_WillObsolete -DFriCAS -Y $FRICAS/algebra -I $FRICAS/algebra
      Use the system command )set compiler args to change these 
      options.
   Compiling Lisp source code from file 
      ./3499552379206056026-25px015.lsp
   Issuing )library command for 3499552379206056026-25px015
   Reading /var/aw/var/LatexWiki/3499552379206056026-25px015.asy
   CatA is now explicitly exposed in frame initial 
   CatA will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/3499552379206056026-25px015
   CatB is now explicitly exposed in frame initial 
   CatB will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/3499552379206056026-25px015
   CatX is now explicitly exposed in frame initial 
   CatX will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/3499552379206056026-25px015
   A is now explicitly exposed in frame initial 
   A will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/3499552379206056026-25px015
   B is now explicitly exposed in frame initial 
   B will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/3499552379206056026-25px015
   MyPkg is now explicitly exposed in frame initial 
   MyPkg will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/3499552379206056026-25px015

fricas
main4(0)

\label{eq4} \mbox{\rm true} (4)
Type: Boolean
fricas
main4(1)

\label{eq5} \mbox{\rm false} (5)
Type: Boolean
fricas
)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 "fricas"
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/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/4520573120428817379-25px017.as
      using Aldor compiler and options 
-O -Fasy -Fao -Flsp -lfricas -Mno-ALDOR_W_WillObsolete -DFriCAS -Y $FRICAS/algebra -I $FRICAS/algebra
      Use the system command )set compiler args to change these 
      options.
   Compiling Lisp source code from file 
      ./4520573120428817379-25px017.lsp
   Issuing )library command for 4520573120428817379-25px017
   Reading /var/aw/var/LatexWiki/4520573120428817379-25px017.asy
   CatA is now explicitly exposed in frame initial 
   CatA will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/4520573120428817379-25px017
   A is now explicitly exposed in frame initial 
   A will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/4520573120428817379-25px017
   CatB is now explicitly exposed in frame initial 
   CatB will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/4520573120428817379-25px017
   B is now explicitly exposed in frame initial 
   B will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/4520573120428817379-25px017

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

fricas
rhxmain()

\label{eq6}\begin{array}{@{}l}
\displaystyle
\left[{\left[{s = \verb#"A x has CatA x"#}, \:{b =  \mbox{\rm true} }\right]}, \: \right.
\
\
\displaystyle
\left.{\left[{s = \verb#"A y has CatA x"#}, \:{b =  \mbox{\rm true} }\right]}, \: \right.
\
\
\displaystyle
\left.{\left[{s = \verb#"B String has CatB String"#}, \:{b =  \mbox{\rm true} }\right]}, \: \right.
\
\
\displaystyle
\left.{\left[{s = \verb#"B Integer has CatB String"#}, \:{b =  \mbox{\rm false} }\right]}\right] 
(6)
Type: List(Record(s: String,b: Boolean))
fricas
)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 "fricas"
#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/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/3633650021500177729-25px019.as
      using Aldor compiler and options 
-O -Fasy -Fao -Flsp -lfricas -Mno-ALDOR_W_WillObsolete -DFriCAS -Y $FRICAS/algebra -I $FRICAS/algebra
      Use the system command )set compiler args to change these 
      options.
   Compiling Lisp source code from file 
      ./3633650021500177729-25px019.lsp
   Issuing )library command for 3633650021500177729-25px019
   Reading /var/aw/var/LatexWiki/3633650021500177729-25px019.asy

fricas
main5(1)

\label{eq7}\left[  \mbox{\rm false} , \:  \mbox{\rm true} \right](7)
Type: List(Boolean)
fricas
main5(2)

\label{eq8}\left[  \mbox{\rm true} , \:  \mbox{\rm true} \right](8)
Type: List(Boolean)
fricas
)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 "fricas"
#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/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/7190335948694378273-25px021.as
      using Aldor compiler and options 
-O -Fasy -Fao -Flsp -lfricas -Mno-ALDOR_W_WillObsolete -DFriCAS -Y $FRICAS/algebra -I $FRICAS/algebra
      Use the system command )set compiler args to change these 
      options.
"/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/7190335948694378273-25px021.as", line 9: 
  x := String
.......^
[L9 C8] #1 (Error) There is no suitable interpretation for the expression String
  The context requires an expression of type IntegralDomain.
     The possible types of the right hand side (`String') are:
          -- Join(SetCategory, 
                StringCategory with 
      ...
The )library system command was not called after compilation.

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

fricas
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 "fricas"
#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/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/2501096951859201286-25px023.as
      using Aldor compiler and options 
-O -Fasy -Fao -Flsp -lfricas -Mno-ALDOR_W_WillObsolete -DFriCAS -Y $FRICAS/algebra -I $FRICAS/algebra
      Use the system command )set compiler args to change these 
      options.
   Compiling Lisp source code from file 
      ./2501096951859201286-25px023.lsp
   Issuing )library command for 2501096951859201286-25px023
   Reading /var/aw/var/LatexWiki/2501096951859201286-25px023.asy
   MyDom is now explicitly exposed in frame initial 
   MyDom will be automatically loaded when needed from 
      /var/aw/var/LatexWiki/2501096951859201286-25px023

fricas
)sh MyDom
MyDom is a domain constructor. Abbreviation for MyDom is MYDOM This constructor is exposed in this frame. 4 Names for 4 Operations in this Domain. ------------------------------- Operations --------------------------------
add2 : (MyDom, MyDom) -> MyDom neg : MyDom -> MyDom sigs : () -> List(Category) sub2 : (MyDom, MyDom) -> MyDom
main8()
>> System error: The value NIL is not of type SIMPLE-VECTOR