(question for Ralf at the bottom of the mail :-) "Mike Hansen" <[EMAIL PROTECTED]> writes:
> >> * Given a domain like "Polynomial Integer", how do I get the base ring > >> "Integer" programatically? This would be like the base_ring method in > >> Sage. > > > > You cannot, currently. One possibility (I never tried in SPAD, but it > > works in Aldor), is to make Polynomial export it's argument. Could you > > give a use case? Maybe there is a workaround. > > When trying to construct an object corresponding to 'Polynomial Fraction > Integer' in Sage, you first want to construct the argument in Sage, and then > make the polynomial ring over that. Currently, I'm just doing some simple > string processing to extract the argument. I just checked, it is indeed possible already now in FriCAS to have a function return a Type, only, you cannot do much with it *within* FriCAS. (I don't know whether this would be easy to change) In any case, it seems to me that it makes sense that certain types, like matrices, polynomials, powerseries export an operation coefficientRing or some such. Comments? Martin The only slight awkwardness I can imagine is as follows: If I export, say, in Polynomial coefficientRing: () -> Ring then the result of baseRing will be a Ring, and may have "forgotten" all the other categories it possibly satisfies. Hm, it seems I will never understand "has" completely - Ralf, could you remind me why the following output is produced by Aldor? [EMAIL PROTECTED]:~/aldor-test$ ./export-type x has PrimitiveType: T x has IntegerType: F x has ArrayType(Character, PackedPrimitiveArray(Character)): T ------------------------------------------------------------------------------- #include "aldor" #include "aldorio" Foo(T: PrimitiveType): with { baseT: () -> PrimitiveType } == add { baseT(): PrimitiveType == T; } import from Integer, Boolean, List OutputType; x == baseT()$Foo(String); import from String; stdout << "x has PrimitiveType: " << (x has PrimitiveType)@Boolean << newline; stdout << "x has IntegerType: " << (x has IntegerType)@Boolean << newline; stdout << "x has ArrayType(Character, PackedPrimitiveArray(Character)): " << (x has ArrayType(Character, PackedPrimitiveArray(Character)))@Boolean << newline; ------------------------------------------------------------------------------- --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---