aboutsummaryrefslogtreecommitdiff
path: root/src/interp/i-coerce.boot
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2009-06-12 17:35:50 +0000
committerdos-reis <gdr@axiomatics.org>2009-06-12 17:35:50 +0000
commit9e86e73fe1aa9115233952ffbf8188b169677d6e (patch)
tree25c19d0732c1af479e9442c7476d122c00f4920c /src/interp/i-coerce.boot
parent9e07dcd91c45bf8b22d932321f5c97e931ffe8ac (diff)
downloadopen-axiom-9e86e73fe1aa9115233952ffbf8188b169677d6e.tar.gz
Support retract of domains.
* interp/i-funsel.boot (findFunctionInDomain): Don't look into categories. * interp/i-coerce.boot (retract): Retract domain objects too. (retract1): Do it. (coerceInteractive): Likewise. * interp/nrunfast.boot (getDomainCategoriesVector): New. (getDomainCompleteCategories): Likewise.
Diffstat (limited to 'src/interp/i-coerce.boot')
-rw-r--r--src/interp/i-coerce.boot10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/interp/i-coerce.boot b/src/interp/i-coerce.boot
index a46711e0..b4756002 100644
--- a/src/interp/i-coerce.boot
+++ b/src/interp/i-coerce.boot
@@ -91,7 +91,9 @@ retract object ==
STRINGP type => 'failed
type = $EmptyMode => 'failed
val := objVal object
- not isWrapped val and val isnt ["%Map",:.] => 'failed
+ if not isWrapped val and val isnt ["%Map",:.] then
+ type ^= $Domain => return "failed"
+ val := wrap eval val
type' := equiType(type)
(ans := retract1 objNew(val,equiType(type))) = 'failed => ans
objNew(objVal ans,eqType objMode ans)
@@ -108,6 +110,8 @@ retract1 object ==
type = $PositiveInteger => objNew(val,$NonNegativeInteger)
type = $NonNegativeInteger => objNew(val,$Integer)
type = $Integer and SINTP unwrap val => objNew(val, $SingleInteger)
+ type = $Domain =>
+ objNew(val, ["Join",:getDomainCompleteCategories unwrap val])
type' := equiType(type)
if not EQ(type,type') then object := objNew(val,type')
(1 = #type') or (type' is ['Union,:.]) or
@@ -456,6 +460,7 @@ canCoerce1(t1,t2) ==
canCoerce(t1,t) and canCoerceByFunction(t,t2) and 'T
ans or member(t1,'((PositiveInteger) (NonNegativeInteger)))
and canCoerce($Integer,t2)
+ t1 is ["Join",:.] => not null member(t2,rest t1) -- for now, gdr.
canCoerceFrom0(t1,t2) ==
-- top level test for coercion, which transfers all RN, RF and RR into
@@ -745,6 +750,9 @@ coerceInteractive(triple,t2) ==
t2 = '$NoValueMode => objNew(val,t2)
if t2 is ['SubDomain,x,.] then t2:= x
-- JHD added category Aug 1996 for BasicMath
+ -- Categories are not domain of computations so we have to handle
+ -- them by hand, until we get a better world. -- gdr, 2009-06-12.
+ t1 is ["Join",:.] and canCoerce(t1,t2) => objNew(val,t2)
member(t1,$LangSupportTypes) =>
t2 = $OutputForm => objNew(val,t2)
t1 = $Domain and conceptualType t2 = $Category