PositiveInteger? and NonNegativeInteger? are subdomains of Integer.
Domain
is a domain whose values are all domains.
Categories are values of the domain SubDomain Domain
.
For example:
axiom
Integer
Type: Domain
axiom
Ring
Unfortunately the original Axiom library did not include
definitions of these domains.
axiom
[Integer,PrimeField(3)]
LISP output:
(UNPRINTABLE UNPRINTABLE)
Type: List Domain
axiom
[Ring,Field]
LISP output:
(UNPRINTABLE UNPRINTABLE)
Type: List SubDomain
? Domain
However OpenAxiom? has implemented Domain
and replaced
SubDomain Domain
with Category
. Here we try to provide
something similar for FriCAS?.
spad
)abbrev domain DOMAIN Domain
Domain():SetCategory with CoercibleTo(InputForm)
== add
coerce(x:%):OutputForm ==
n:SExpression:=devaluate(x)$Lisp
#n=1 => car(n) pretend OutputForm
n pretend OutputForm
x = y ==
devaluate(x)$Lisp = devaluate(y)$Lisp
coerce(x:%):InputForm ==
devaluate(x)$Lisp
spad
Compiling FriCAS source code from file
/var/zope2/var/LatexWiki/1943939720501734443-25px004.spad using
old system compiler.
DOMAIN abbreviates domain Domain
------------------------------------------------------------------------
initializing NRLIB DOMAIN for Domain
compiling into NRLIB DOMAIN
compiling exported coerce : $ -> OutputForm
Time: 0.01 SEC.
compiling exported = : ($,$) -> Boolean
Time: 0 SEC.
compiling exported coerce : $ -> InputForm
DOMAIN;coerce;$If;3 is replaced by devaluate
Time: 0.01 SEC.
(time taken in buildFunctor: 0)
;;; *** |Domain| REDEFINED
;;; *** |Domain| REDEFINED
Time: 0 SEC.
Cumulative Statistics for Constructor Domain
Time: 0.02 seconds
finalizing NRLIB DOMAIN
Processing Domain for Browser database:
--->-->Domain(): Missing Description
------------------------------------------------------------------------
Domain is now explicitly exposed in frame initial
Domain will be automatically loaded when needed from
/var/zope2/var/LatexWiki/DOMAIN.NRLIB/DOMAIN
spad
)abbrev domain SUBDOM SubDomain
SubDomain(D:Domain):SetCategory with CoercibleTo(InputForm)
== add
coerce(x:%):OutputForm ==
n:SExpression:=devaluate(x)$Lisp
#n=1 => car(n) pretend OutputForm
n pretend OutputForm
x = y ==
devaluate(x)$Lisp = devaluate(y)$Lisp
coerce(x:%):InputForm ==
devaluate(x)$Lisp
spad
Compiling FriCAS source code from file
/var/zope2/var/LatexWiki/7683481912116905837-25px005.spad using
old system compiler.
SUBDOM abbreviates domain SubDomain
------------------------------------------------------------------------
initializing NRLIB SUBDOM for SubDomain
compiling into NRLIB SUBDOM
compiling exported coerce : $ -> OutputForm
Time: 0.01 SEC.
compiling exported = : ($,$) -> Boolean
Time: 0.01 SEC.
compiling exported coerce : $ -> InputForm
SUBDOM;coerce;$If;3 is replaced by devaluate
Time: 0 SEC.
(time taken in buildFunctor: 0)
;;; *** |SubDomain| REDEFINED
;;; *** |SubDomain| REDEFINED
Time: 0 SEC.
Cumulative Statistics for Constructor SubDomain
Time: 0.02 seconds
finalizing NRLIB SUBDOM
Processing SubDomain for Browser database:
--->-->SubDomain(): Missing Description
------------------------------------------------------------------------
SubDomain is now explicitly exposed in frame initial
SubDomain will be automatically loaded when needed from
/var/zope2/var/LatexWiki/SUBDOM.NRLIB/SUBDOM
axiom
[Integer,PrimeField(3)]
Type: List Domain
axiom
%.1
Type: Domain
axiom
[Ring,Field,IntegerNumberSystem]
Type: List SubDomain
? Domain
Although it is exported:
axiom
)sh Domain
Domain is a domain constructor
Abbreviation for Domain is DOMAIN
This constructor is exposed in this frame.
------------------------------- Operations --------------------------------
?=? : (%,%) -> Boolean coerce : % -> InputForm
coerce : % -> OutputForm hash : % -> SingleInteger
latex : % -> String ?~=? : (%,%) -> Boolean
unfortunately the interpreter still does not seem to be
able to call the coerce
to InputForm
function even
though the operation is exported by Domain.
axiom
Integer::InputForm
Cannot convert from type Domain to InputForm for value
Integer()
Ring::InputForm
Cannot convert from type SubDomain Domain to InputForm for value
Ring()
Waldek suggested the following way of converting a type
to InputForm?.
spad
)abbrev package GETTYNM GetTypeName
GetTypeName(T : Type) : with
coerce: () -> InputForm
== add
coerce() == (devaluate(T)$Lisp) pretend InputForm
spad
Compiling FriCAS source code from file
/var/zope2/var/LatexWiki/6678787279064774657-25px010.spad using
old system compiler.
GETTYNM abbreviates package GetTypeName
------------------------------------------------------------------------
initializing NRLIB GETTYNM for GetTypeName
compiling into NRLIB GETTYNM
compiling exported coerce : () -> InputForm
Time: 0.01 SEC.
(time taken in buildFunctor: 0)
;;; *** |GetTypeName| REDEFINED
;;; *** |GetTypeName| REDEFINED
Time: 0 SEC.
Warnings:
[1] coerce: pretend(InputForm) -- should replace by @
Cumulative Statistics for Constructor GetTypeName
Time: 0.01 seconds
finalizing NRLIB GETTYNM
Processing GetTypeName for Browser database:
--->-->GetTypeName((coerce ((InputForm)))): Not documented!!!!
--->-->GetTypeName(constructor): Not documented!!!!
--->-->GetTypeName(): Missing Description
------------------------------------------------------------------------
GetTypeName is now explicitly exposed in frame initial
GetTypeName will be automatically loaded when needed from
/var/zope2/var/LatexWiki/GETTYNM.NRLIB/GETTYNM
axiom
coerce()$GetTypeName(Integer)
axiom
coerce()$GetTypeName(SquareMatrix(3,PrimeField 7))
axiom
unparse(%)
Type: String