diff --git a/books/bookvol10.3.pamphlet b/books/bookvol10.3.pamphlet index 905a439..689dbb9 100644 --- a/books/bookvol10.3.pamphlet +++ b/books/bookvol10.3.pamphlet @@ -1487,6 +1487,250 @@ AntiSymm(R:Ring, lVar:List Symbol): Export == Implement where @ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{domain ANY Any} +<>= +)set break resume +)sys rm -f Any.output +)spool Any.output +)set message test on +)set message auto off +)clear all + +--S 1 of 18 +a:Any := [1,2] +--R +--R +--R (1) [1,2] +--R Type: List PositiveInteger +--E 1 + +--S 2 of 18 +b:Any := [1,2] +--R +--R +--R (2) [1,2] +--R Type: List PositiveInteger +--E 2 + +--S 3 of 18 +(a = b)@Boolean +--R +--R +--R (3) true +--R Type: Boolean +--E 3 + +--S 4 of 18 +c := [1,2] +--R +--R +--R (4) [1,2] +--R Type: List PositiveInteger +--E 4 + +--S 5 of 18 +typeOf a +--R +--R +--R (5) Any +--R Type: Domain +--E 5 + +--S 6 of 18 +typeOf c +--R +--R +--R (6) List PositiveInteger +--R Type: Domain +--E 6 + +--S 7 of 18 +(a = c)@Boolean +--R +--R +--R (7) true +--R Type: Boolean +--E 7 + +--S 8 of 18 +b := [1,3] +--R +--R +--R (8) [1,3] +--R Type: List PositiveInteger +--E 8 + +--S 9 of 18 +(a = b)@Boolean +--R +--R +--R (9) false +--R Type: Boolean +--E 9 + +--S 10 of 18 +a := "A" +--R +--R +--R (10) "A" +--R Type: String +--E 10 + +--S 11 of 18 +(a = b)@Boolean +--R +--R +--R (11) false +--R Type: Boolean +--E 11 + +--S 12 of 18 +b := "A" +--R +--R +--R (12) "A" +--R Type: String +--E 12 + +--S 13 of 18 +(a = b)@Boolean +--R +--R +--R (13) true +--R Type: Boolean +--E 13 + +--S 14 of 18 +Sae := SAE(FRAC INT, UP(x, FRAC INT), x^2-3) +--R +--R +--R (14) +--R SimpleAlgebraicExtension(Fraction Integer,UnivariatePolynomial(x,Fraction Int +--R eger),x*x-3) +--R Type: Domain +--E 14 + +--S 15 of 18 +a := generator()$Sae +--R +--R +--R (15) x +--RType: SimpleAlgebraicExtension(Fraction Integer,UnivariatePolynomial(x,Fraction Integer),x*x-3) +--E 15 + +--S 16 of 18 +b := generator()$Sae +--R +--R +--R (16) x +--RType: SimpleAlgebraicExtension(Fraction Integer,UnivariatePolynomial(x,Fraction Integer),x*x-3) +--E 16 + +--S 17 of 18 +(a = b)@Boolean +--R +--R +--R (17) true +--R Type: Boolean +--E 17 + +--S 18 of 18 +)show Any +--R +--R Any is a domain constructor +--R Abbreviation for Any is ANY +--R This constructor is exposed in this frame. +--R Issue )edit bookvol10.3.spad.pamphlet to see algebra source code for ANY +--R +--R------------------------------- Operations -------------------------------- +--R ?=? : (%,%) -> Boolean any : (SExpression,None) -> % +--R coerce : % -> OutputForm dom : % -> SExpression +--R domainOf : % -> OutputForm hash : % -> SingleInteger +--R latex : % -> String obj : % -> None +--R objectOf : % -> OutputForm ?~=? : (%,%) -> Boolean +--R showTypeInOutput : Boolean -> String +--R +--E 18 + +)spool +)lisp (bye) +@ +<>= +==================================================================== +Any examples +==================================================================== + +Any implements a type that packages up objects and their types in +objects of Any. Roughly speaking that means that if s : S then when +converted to Any, the new object will include both the original object +and its type. This is a way of converting arbitrary objects into a +single type without losing any of the original information. Any object +can be converted to one of Any. + +So we can convert a list to type Any + +a:Any := [1,2] + [1,2] + +and another list to type Any + +b:Any := [1,2] + [1,2] + +Equality works + +(a = b)@Boolean + true + +We can compare the Any type with other types: + +c := [1,2] + +typeOf a + +typeOf c + +(a = c)@Boolean + + +If the values are differennt than we see the difference: + +b := [1,3] + [1,3] + +(a = b)@Boolean + false + +The Any type works with many types: + +a := "A" + "A" + +(a = b)@Boolean + false + +b := "A" + "A" + +(a = b)@Boolean + true + +This is true for more complex types: + +Sae := SAE(FRAC INT, UP(x, FRAC INT), x^2-3) + +a := generator()$Sae + x + +b := generator()$Sae + x + +(a = b)@Boolean + true + +See Also: +o )show Any + +@ \pagehead{Any}{ANY} \pagepic{ps/v103any.ps}{ANY}{1.00} {\bf See}\\ @@ -1560,6 +1804,8 @@ Any(): SetCategory with dom x == x.dm domainOf x == x.dm pretend OutputForm x = y == (x.dm = y.dm) and EQ(x.ob, y.ob)$Lisp + x = y == + (x.dm = y.dm) and EQUAL(x.ob, y.ob)$Lisp objectOf(x : %) : OutputForm == spad2BootCoerce(x.ob, x.dm, diff --git a/changelog b/changelog index 006b292..970afdc 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,6 @@ +20090702 tpd src/axiom-website/patches.html 20090702.01.tpd.patch +20090702 tpd src/algebra/Makefile add Any.regress, Any.help +20090702 tpd books/bookvol10.3 fix = in Any, add regression and help files 20090628 tpd src/axiom-website/patches.html 20090628.01.tpd.patch 20090628 tpd src/algebra/Makefile add MathML regress, help 20090628 tpd src/algebra/Makefile add TexFormat regress, help diff --git a/src/algebra/Makefile.pamphlet b/src/algebra/Makefile.pamphlet index dfe05db..eb46aaa 100644 --- a/src/algebra/Makefile.pamphlet +++ b/src/algebra/Makefile.pamphlet @@ -16437,6 +16437,7 @@ This keeps the regression test list in the algebra Makefile. HELPFILE=${HELP}/help.help SPADHELP=\ + ${HELP}/Any.help \ ${HELP}/ApplicationProgramInterface.help \ ${HELP}/ArrayStack.help \ ${HELP}/AssociationList.help ${HELP}/BalancedBinaryTree.help \ @@ -16536,7 +16537,7 @@ is put into a int/Makefile.algebra and then executed by make. <>= TESTSYS= ${OBJ}/${SYS}/bin/interpsys -REGRESS=\ +REGRESS= Any.regress \ ApplicationProgramInterface.regress \ ArrayStack.regress \ AssociationList.regress BalancedBinaryTree.regress \ @@ -16631,8 +16632,16 @@ all: ${REGRESS} @echo algebra test cases complete. @ <>= +${HELP}/Any.help: ${BOOKS}/bookvol10.3.pamphlet + @echo 7000 create Any.help from ${BOOKS}/bookvol10.3.pamphlet + @${TANGLE} -R"Any.help" ${BOOKS}/bookvol10.3.pamphlet >${HELP}/Any.help + @cp ${HELP}/Any.help ${HELP}/ANY.help + @${TANGLE} -R"Any.input" ${BOOKS}/bookvol10.3.pamphlet \ + >${INPUT}/Any.input + @echo "Any (ANY)" >>${HELPFILE} + ${HELP}/ApplicationProgramInterface.help: ${BOOKS}/bookvol10.4.pamphlet - @echo 7000 create ApplicationProgramInterface.help from \ + @echo 7005 create ApplicationProgramInterface.help from \ ${BOOKS}/bookvol10.4.pamphlet @${TANGLE} -R"ApplicationProgramInterface.help" \ ${BOOKS}/bookvol10.4.pamphlet \ diff --git a/src/axiom-website/patches.html b/src/axiom-website/patches.html index dbc6dc8..4a975a0 100644 --- a/src/axiom-website/patches.html +++ b/src/axiom-website/patches.html @@ -1681,5 +1681,7 @@ bookvol10.4 WEIER +-> conversion
bookvol5 default set message autoload off
20090628.01.tpd.patch bookvol10.3 TexFormat fix horizontal fractions
+20090702.01.tpd.patch +bookvol10.3 fix = in Any, add regression and help files