)abbrev domain SUP SparseUnivariatePolynomial
SparseUnivariatePolynomial(R : CommutativeRing):
with ...
Join(CommutativeRing,
R has IntegerLike or R has FiniteField or
R has SuchAndSuchCategory => UniqueFactorizationDomain
)
== add
Rep == ?
factor(f : UP R) : Factored (UP R) ==
R has IntegerLike => factorUPOverInteger f
R has FiniteField => factorUPByExtendedBerlekemp(R, f)
R has SuchAndSuchCategory => factorUPByGeneric(R, f)
Of course that can be done. But I have the impression you haven't that
you haven't got the point in me writing
if R has Field then
foo(r: R): % == (1/r) pretend %
else
foo(r: R): % == r pretend %
instead of
foo(r: R): % == if R has Field then
(1/r) pretend %
else
r pretend %
In the second case (as in your case above), calling factor will *always*
perform the test "R has Field". In my version that test is only at
instantiation time of the domain.
I am trying to find out whether the language allows, in principle, a clear
and efficient dispatching for such operations which have a complex set of
implementation cases overlapping non-trivially and having different
generality levels.
I think my previous mail should have shown you how dispatching can be
done on a domain level. The exports would simply list the function
unconditionally.
Ralf
--
You received this message because you are subscribed to the Google Groups "FriCAS -
computer algebra system" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/fricas-devel?hl=en.