On Wed, May 14, 2008 at 5:04 PM, Ralf Hemmecke wrote:
> To me the problem is bad design.
>
> halfExtendedSubResultantGcd1 and
> halfExtendedSubResultantGcd2 could well have returned the
> same type Record(gcd: P, coef: P). By the name of the function
> it would have been clear how to interpret the coef entry.
>
> In fact, I would rather have liked that both functions simply return
> a multivalue or a Cross(P, P), but unfortunately, that does not
> work in panAxiom.
What is a "multivalue"? Is it a type in Aldor?
In Axiom it is possible for functions to return objects of type
'Product(P,P)' or 'DirectProduct(2,P)' but a general n-ary Cross type
is not available in SPAD or the Axiom library.
>
> If you look closely, then
>
> g := if mdeg p < mdeg ts_v
> then gcd halfExtendedSubResultantGcd2(ts_v,p)$P
> else gcd halfExtendedSubResultantGcd1(p,ts_v)$P
>
> would then have been a shorter version of the "if" including the
> following "g:=gcd(n,d)". But I guess that does not yet work in SPAD.
>
In Axiom a function has type
f:Mapping(A,B,C, ... )
usually written in the more convenient syntax
f:(B,C, ... ) -> A
but this notation does not imply that the input domain to the function
is considered to be of type
Cross(B,C, ... )
Instead we say that the function has multiple inputs.
(There is a long discussion of this on the axiom-wiki.)
So in Axiom one must write a slightly more awkward expression:
g := if mdeg p < mdeg ts_v
then (x+->gcd(x.gcd,x.coef2))(halfExtendedSubResultantGcd2(ts_v,p)$P)
else (x+->gcd(x.gcd,x.coef1))(halfExtendedSubResultantGcd1(p,ts_v)$P)
where the anonymous function untangles the record as inputs. It is not
necessary that 'halfExtendedSubResultantGcd1' and
'halfExtendedSubResultantGcd2' return the same type.
Regards,
Bill Page.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
open-axiom-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/open-axiom-devel