Bill Page wrote: > > Do you think we should be allowed to write something like the > following in the OpenAxiom compiler (SPAD)? > > (X:Domain):Domain+->List X > > i.e. define a function that takes a domain as an argument and returns > a domain? Could we use such a thing in a statically typed language? I > suppose not. >
In FriCAS there is no Domain, but code like this should work in the compiler. In experimantal version of factoring code I have (or had): extField : FiniteAlgebraicExtensionField(F) := get_extension(n) do_factor(p, n, extField) and in do_factor there was loop coercing coefficients of p to extField and calling factor(p)$extField (actually, and internal factoring function). The point is that get_extension tried to choose most efficient extension and returend it. The rest of code just uses extField only caring about its category, and not how it was choosen and which particular extension it is. Or look at simplifyCoeffs in pfo.spad.pamphlet. Here nR is given by literal constructor, but parameter to this constructor is only known at runtime. Equally well nR could have been computed via a separate function. There is several places in algebra where we compute new domains or packages at runtime and than call functions from them. Due to limitation of old Axiom compiler new domains are computed by inline code. But in FriCAS they can by computed by functions. Note that all that is statically known about such computed domain is its category. If that category is Type than there is litte which you can do with such domain. But once you have more specific category, then such computed domains have many uses. Note: that is reason why categories are not first class. With first class categories code using first class domains would be impossible to check statically. -- Waldek Hebisch hebi...@math.uni.wroc.pl -- 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 fricas-devel@googlegroups.com. To unsubscribe from this group, send email to fricas-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/fricas-devel?hl=en.