RE: Can I decompose a domain ?

"Page, Bill" <[email protected]>
Newsgroups gmane.comp.mathematics.axiom.general
Message-ID <CAE9B164E720CE4D8727792DF8F28AE3456A04@corporateex02.Corporate.drdc-rddc.gc.ca>
On Monday, March 20, 2006 7:53 PM William Sit wrote:
> 
> Francois Maltey wrote:
> > 
> > Myfunction (a : Expression ...) : String ==
> >   is a an Expression Integer => "Integer"
> >   -- or an other calculus.
> >   is a an Expression Franction Integer => "Rationnal"
> >   is a an Expression Complex ... => "Complex"
> >   -- so I can use real and imag.
> >   is a an Expression Float => "Float"
> >   "A rare domain".
> > 
> 
> This is a bit tricky, since any function in Axiom must have
> a specific domain as source. The Axiom domain ANY is a
> coverall. Here is a try:
> 
> Myfunction(a:Any):String ==
>   aDom := unparse ((domainOf a)::InputForm)
>   substring?("Expression",aDom,1)=>delete(aDom, 1..11)
>   "A rare domain"
> 
> To use the function, coerce the input to Any, such as:
> 
> Myfunction(resInteger::Any)
> 

I thought this was an interesting question so I prepared a
simple example based (more or less) on the idea of William Sit
above:

http://wiki.axiom-developer.org/SandBoxManipulatingDomains

Instead of manipulating strings, I think it is better to
work with S-expressions. This is both more efficient and
more specific. For this purpose the ANY domain provides a
function named 'dom' that is similar to 'domainOf'.

Regards,
Bill Page.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.