UnivariateFreeRing2(
     R : Join(ArithmeticType, ExpressionType),
     RX: UnivariateFreeRing R,
     S : Join(ArithmeticType, ExpressionType),
     SX: UnivariateFreeRing S
): with {
        map: (R -> S) -> RX -> SX;
} == add {
        map(f:R -> S)(p:RX):SX == {
                q:SX := 0;
                for term in p repeat {
                        (c, n) := term;
                        q := add!(q, f c, n);
                }
                q;
        }
}

Can you write that in JAVA or CLOS? I would be happy to see it.

Ignoring for now the details of the Aldor library, why would you
expect this to be difficult? Java supports functions that return
functions ...

I'm not so fluent in JAVA, but take for example a semigroup.
Can you do such simple thing as giving an interface for it in JAVA.

define Monoid: Category == with {
  1: %
  *: (%, %) -> %
}

The problem is the "1: %" as a constant (not a nullary function).
An abstract class is no solution since, we might need multiple inheritance from various interfaces (imagine to build a Ring afterwards).

Maybe it works to translate UnivariateFreeRing2 to JAVA, but I guess the code will look terribly complicated if it incorporates the conditions on R and RX, S and SX. Yes, JAVA generics are allowed.
(Well, I shut up, that is not a mailing list about JAVA.)

Ralf


_______________________________________________
Axiom-developer mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/axiom-developer

Reply via email to