22.5 ACFraction

610adom: ACFraction 610a  (569a)
ACFraction(S: IntegralDomain): with {
        coerce: % -> Fraction S;
        coerce: Fraction S -> %;
        exports of Fraction from LibAldor 610b
        exports of Fraction from LibAxiom 611d
} == Fraction S add {
        Rep == Fraction S;
        import from Rep;
        coerce(x: %): Fraction S == rep x;
        coerce(x: Fraction S): % == per x;
        implementation of Fraction from LibAldor 611a
}

Defines:
ACFraction, used in chunk 54.
610bexports of Fraction from LibAldor 610b  (610a)
if S has OutputType then OutputType;
inv: S -> %;

Uses OutputType 570.
611aimplementation of Fraction from LibAldor 611a  (610a)
if S has OutputType then {
        (tw: TextWriter) << (x: %): TextWriter == hconcat(tw, x::OutputForm);
}
inv(x: S): % == 1 / x;

Uses OutputType 570.
ToDo 86
mrx 23 11-Feb-2007: The following two are better handled with macros in include/combinat.as.nw, since otherwise Aldor will not know which signature to chose in, for example

assert(one? denominator r);

611bNOTYET exports of Fraction from LibAldor 611b
numerator: % -> S;
denominator: % -> S;
611cNOTYET implementation of Fraction from LibAldor 611c
numerator(x: %): S == numer rep x;
denominator(x: %): S == denom rep x;
611dexports of Fraction from LibAxiom 611d  (610a)
canonical @ Category;
QuotientFieldCategory(S);