On Thu, Sep 18, 2008 at 1:03 PM, Waldek Hebisch wrote:
> ...
> What you wrote works for "simple" domains.  But many domains
> have parameters.  For example, given:
>
> (x^3+1)::Polynomial PF(5)
>
> you need some way to get the prime 5 into InputForm.
>

Here is a simple patch to 'interp/i-coerce.boot' that seems to provide
automatic coercion of all domains and categories into InputForm in the
interpreter. According to documentation in 'i-coerce.boot' it is also
possible to call this from algebra code but I haven't tried that yet.
The patch is based on a lot of study of how something similar was done
for coercions of domains and categories to OutputForm.

There are examples on wiki page:

  http://axiom-wiki.newsynthesis.org/SubDomain

which also includes definitions of the new algebra domains 'Domain'
and 'SubDomain' for other purposes.

Of course more testing would be very desirable!

[EMAIL PROTECTED]:~/fricas-src$ svn diff
Index: src/interp/i-coerce.boot
===================================================================
--- src/interp/i-coerce.boot    (revision 370)
+++ src/interp/i-coerce.boot    (working copy)
@@ -775,8 +775,10 @@
   t2 = '$NoValueMode => objNew(val,t2)
   if t2 is ['SubDomain,x,.] then t2:= x
   -- JHD added category Aug 1996 for BasicMath
+  -- WSP modified for coercion to InputForm Sept 2008
   t1 in '((Category) (Mode) (Domain) (SubDomain (Domain))) =>
     t2 = $OutputForm => objNew(val,t2)
+    t2 = '(InputForm) => objNewWrap(val,t2)
     NIL
   t1 = '$NoValueMode =>
     if $compilingMap then clearDependentMaps($mapName,nil)

---

Regards,
Bill Page.

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to