Martin's beautiful idea: We can use the Aldor fricas (1) -> <aldor> #include "fricas" fricas Compiling FriCAS source code from file
/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/mymonoid.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.fricas Compiling Lisp source code from file ./mymonoid.lsp Issuing )library command for mymonoid fricas Reading #P"/var/aw/var/LatexWiki/mymonoid.asy" MyMonoid is now explicitly exposed in frame initial aldor #include "fricas"
#library MyMonoid "mymonoid.ao";
import from MyMonoid;
MyWord: with {
coerce: String -> %;
c:(%,
aldor Compiling FriCAS source code from file
/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/7928879980347790310-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
./7928879980347790310-25px002.lsp
Issuing )library command for 7928879980347790310-25px002
Reading #P"/var/aw/var/LatexWiki/7928879980347790310-25px002.asy"
MyWord is now explicitly exposed in frame initialThis is what Axiom sees: fricas )sh MyMonoid fricas )sh MyWord Try it: fricas a := "Bingo"::MyWord
Type: MyWord?
fricas square a Type: MyWord?
fricas MyWord has MyMonoid(MyWord,
Type: Boolean
That's pretty cool that FriCAS knows But: fricas MyWord has MyMonoid(MyWord,
Type: Boolean
Oops, that's not cool! :( Aldor and the FriCAS interpreter ought to be able to do better than this. Here are some more examples: aldor #include "fricas"
#library MyMonoid "mymonoid.ao";
import from MyMonoid;
MyInt: with {
coerce: Integer -> %;
+:(%,
aldor Compiling FriCAS source code from file
/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/774031628094989668-25px006.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
./774031628094989668-25px006.lsp
Issuing )library command for 774031628094989668-25px006
Reading #P"/var/aw/var/LatexWiki/774031628094989668-25px006.asy"
MyInt is now explicitly exposed in frame initialThis is what FriCAS sees: fricas )sh MyInt Try it: fricas b := 3::MyInt
Type: MyInt?
fricas b+1
Type: MyInt?
fricas square b Type: MyInt?
This is very general. Notice that we can rename the monoid operation from * to +! aldor #include "fricas"
#library MyMonoid "mymonoid.ao";
import from MyMonoid;
MyFloat: with {
coerce: DoubleFloat -> %;
+:(%,
aldor Compiling FriCAS source code from file
/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/5335661638819928165-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
./5335661638819928165-25px009.lsp
Issuing )library command for 5335661638819928165-25px009
Reading #P"/var/aw/var/LatexWiki/5335661638819928165-25px009.asy"
MyFloat is now explicitly exposed in frame initialThis is what FriCAS sees: fricas )sh MyFloat Try it: fricas f := 3.1::DoubleFloat::MyFloat Here's a variation on the example aldor #include "fricas" define DirProdCat(n: Integer, aldor Compiling FriCAS source code from file
/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/mydirprod.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 ./mydirprod.lsp
Issuing )library command for mydirprod
Reading #P"/var/aw/var/LatexWiki/mydirprod.asy"
DirProdCat is now explicitly exposed in frame initial Try it: fricas x:= Integer; Type: Type
fricas y:= NonNegativeInteger; Type: Type
fricas DPx ==> DirProd(2, Type: Void
fricas DPx has DirProdCat(2, The results show that the Aldor compiler treats a domain (R) and an element of a domain (n) differently in terms of information retained for the fricas )show DirProd(2, fricas )show DirProd(2, |