Martin Rubey wrote:
> OK, great.  Now, the only obstacle is to fix the bug concerning 
> 
> coerce: % -> SpeciesCategory Integer
> 
> without that one, I don't think I want to embark on the adventure.  There are
> certainly more technical problems with SPAD to overcome...
> 
> Any ideas?  More info needed?
> 

The patch below should fix the coerce problem.  Also, it should allow
calling functions like co from Spad code.

diff -u fricas.bb/src/interp/apply.boot fricas/src/interp/apply.boot
--- fricas.bb/src/interp/apply.boot     2008-11-17 18:38:39.000000000 -0500
+++ fricas/src/interp/apply.boot        2008-11-19 19:42:17.000000000 -0500
@@ -100,7 +100,7 @@
       m':= SUBLIS(sl,map.(1))
       x':=
         form':= [f,:[t.expr for t in Tl]]
-        m'=$Category or isCategoryForm(m',e) => form'
+        (m'=$Category or isCategoryForm(m',e)) and ATOM(f) => form'
         -- try to deal with new-style Unions where we know the conditions
         op = "elt" and f is ['XLAM,:.] and IDENTP(z:=CAR argl) and
           (c:=get(z,'condition,e)) and
diff -u fricas.bb/src/interp/i-spec1.boot fricas/src/interp/i-spec1.boot
--- fricas.bb/src/interp/i-spec1.boot   2008-11-17 18:38:39.000000000 -0500
+++ fricas/src/interp/i-spec1.boot      2008-11-19 20:22:16.000000000 -0500
@@ -380,13 +380,16 @@
   $declaredMode: local := NIL
   m:= evaluateType unabbrev rhs
   not isLegitimateMode(m,NIL,NIL) => throwKeyedMsg("S2IE0004",[m])
-  categoryForm?(m) => throwKeyedMsg("S2IE0014",[m])
+  -- categoryForm?(m) => throwKeyedMsg("S2IE0014",[m])
   $declaredMode:= m
   not atom(lhs) and putTarget(lhs,m)
   ms := bottomUp lhs
   first ms ^= m =>
     throwKeyedMsg("S2IC0011",[first ms,m])
-  putValue(op,getValue lhs)
+  if categoryForm?(m) then
+      putValue(op, objNew(devaluate objValUnwrap getValue lhs, m))
+  else
+      putValue(op,getValue lhs)
   putModeSet(op,ms)
 
 --% Handlers for COERCE
@@ -405,7 +408,7 @@
   $declaredMode: local := NIL
   m := evaluateType unabbrev rhs
   not isLegitimateMode(m,NIL,NIL) => throwKeyedMsg("S2IE0004",[m])
-  categoryForm?(m) => throwKeyedMsg("S2IE0014",[m])
+  -- categoryForm?(m) => throwKeyedMsg("S2IE0014",[m])
   $declaredMode:= m
   -- 05/16/89 (RSS) following line commented out to give correct
   -- semantic difference between :: and @
@@ -435,7 +438,10 @@
     $genValue => coerceOrRetract(v,t2)
     objNew(getArgValue(tree,t2),t2)
   val:= value or throwKeyedMsgCannotCoerceWithValue(e,t1,m)
-  putValue(op,val)
+  if categoryForm?(m) then
+      putValue(op, objNew(devaluate objValUnwrap val, m))
+  else
+      putValue(op,val)
   objMode(val)
 
 --% Handlers for COLLECT


-- 
                              Waldek Hebisch
[EMAIL PROTECTED] 

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