[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [Axiom-math] Can I decompose a domain ?
From: |
Page, Bill |
Subject: |
RE: [Axiom-math] Can I decompose a domain ? |
Date: |
Mon, 20 Mar 2006 21:43:00 -0500 |
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.