On 11/14/2008 09:00 AM, Martin Rubey wrote:
> I'd like to report on a curious problem I have with SPAD/Aldor, which Python
> does not seem to have.
> 
> In Axiom, we currently have the (mostly unused) Categories
> 
> CoercibleTo S, RetractableTo S and ConvertibleTo S that provide
> 
> coerce: % -> S, coerce: S -> % and retract: % -> S
> 
> respectively.

Not quite true.

CoercibleTo(S:Type): Category == with
     coerce: % -> S

ConvertibleTo(S:Type): Category == with
     convert: % -> S

RetractableTo(S: Type): Category == with
     coerce:       S -> %
     retractIfCan: % -> Union(S,"failed")
     retract:      % -> S
   add
     retract(s) ==
       (u:=retractIfCan s) case "failed" => error "not retractable"
       u

> Very unfortunately, currently in almost all cases the query "has CoercibleTo
> Something" will return false, because the coerce function is not inherited by
> the category.

> Now, I would like that for domains of the same category, say
> UnivariatePolynomialCategory, that differ only in the representation of their
> elements, say sparse or dense, we would have

> A has CoercibleTo B and B has CoercibleTo A

OK, let's say I take AbelianMonoid as a category. For A, I take Integer 
and for B, I take String (just let's suppose 0: String is the empty 
string and +: (String, String) -> String is concatenation.

One can easily find the homomorphism (of monoids) #: String -> Integer 
(the length of the string) in one direction and call it coerce. But the 
other direction I find a bit difficult to come up with. ;-)

Looks like your specification of the problem is too imprecise.

Ralf

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
open-axiom-devel mailing list
open-axiom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open-axiom-devel

Reply via email to