Serge D. Mechveliani wrote:
> 
> People,
> I have the two questions.
> 
> 1. Extracting agrument domain from under a constructor
> ------------------------------------------------------
> Is it possible in Spad to extract an argument domain (type) from a 
> constructed domain?

There is no general Spad level way to do it.
> 
> Can  D  be extracted from  F  by some operations,
> so that, for example, the operations  `1 :: D',  `(f^2) $UP(x, D)'  
> become possible?

One can extract arguments of domain in low-level way.  I was
thinking about adding such operation as standard feature.
However, ATM I am not sure about details.  One possibility,
general but less efficient, is to just expose existing
low level routines.  However, this would give you arguments
just as a Type and you would have to use 'pretend' to get
correct category.  Another possiblilty is to add operation
called 'baseDomain' to Fraction and some other domains.
That would allow to get correct category, but would mean
more work adding such functions to the library.
You can implement variation of second way yourself:

)abbrev domain MYFRAC MyFraction
MyFraction(S : IntegralDomain): QuotientFieldCategory S with
       getBaseDomain : () -> IntegralDomain
       if S has IntegerNumberSystem and S has OpenMath then OpenMath
       if S has Canonical and S has GcdDomain and S has canonicalUnitNormal
           then Canonical
   == Fraction(S) add
      getBaseDomain() == S

You should be able to use MyFraction is most places where Fraction
is usable and use getBaseDomain to have acces to S.

BTW: In most cases where I would like to know S I need some way
to decide that the domain is Fraction, so you probably need more
than 'getBaseDomain'.

BTW2: In few places in the library there is code which tries to
determine if domain is of specific form and handle it is special
way.  Unfortunatly, this is exactly code which works with fraction,
but may fail when given MyFraction.

-- 
                              Waldek Hebisch
[email protected] 

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/fricas-devel?hl=en.

Reply via email to