]>
The syntax for defining a domain constructor is the same as for any function in Axiom:
As this definition usually extends over many lines, a expression is generally used instead. where
A recommended format for the definition of a domain is:
DomainForm : Exports == Implementation where
optional type declarations
Exports == [ Category Assertions] with
list of exported operations
Implementation == [ Add Domain] add
[Rep := Representation]
list of function definitions for exported operations
Note: The brackets [ ] here denote optionality.
A complete domain constructor definition for QuadraticForm is shown below. Interestingly, this little domain illustrates all the new concepts you need to learn.
A domain constructor can take any number and type of parameters. QuadraticForm takes a positive integer and a field as arguments. Like a package, a domain has a set of explicit exports and an implementation described by a capsule. Domain constructors are documented in the same way as package constructors.
Domain QuadraticForm(n, K), for a given positive integer and domain , explicitly exports three operations:
Compared with the corresponding syntax given for the definition of a package, you see that a domain constructor has three optional parts to its definition: Category Assertions, Add Domain, and Representation.