aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2007-10-18 14:02:33 +0000
committerdos-reis <gdr@axiomatics.org>2007-10-18 14:02:33 +0000
commitd6ea92cf052ca5a8a8a88add347aefe78cb3303b (patch)
tree1c921fd6ad4a9e229742f4150eaf1c32bf74944a /src
parent3c643ccfe92e3fc3282a4701f70ce76b1199880e (diff)
downloadopen-axiom-d6ea92cf052ca5a8a8a88add347aefe78cb3303b.tar.gz
Fix SF/1795259
* aggcat.spad.pamphlet (HomogeneousAggregate): Make CoercibleTo(OutputForm) if argument is of that category. (BinaryRecursiveAggregate): Weaken condition for coercion to OutputForm. (OneDimensionalArrayAggregate): Likewise. (Tuple): Likewise. (IndexedList): Likewise. * tree.spad.pamphlet: Likewise.
Diffstat (limited to 'src')
-rw-r--r--src/algebra/ChangeLog12
-rw-r--r--src/algebra/aggcat.spad.pamphlet19
-rw-r--r--src/algebra/array1.spad.pamphlet2
-rw-r--r--src/algebra/list.spad.pamphlet3
-rw-r--r--src/algebra/tree.spad.pamphlet2
5 files changed, 28 insertions, 10 deletions
diff --git a/src/algebra/ChangeLog b/src/algebra/ChangeLog
index 4fa56e90..40cf4385 100644
--- a/src/algebra/ChangeLog
+++ b/src/algebra/ChangeLog
@@ -1,3 +1,15 @@
+2007-10-18 Gabriel Dos Reis <gdr@cs.tamu.edu>
+
+ Fix SF/1795259
+ * aggcat.spad.pamphlet (HomogeneousAggregate): Make
+ CoercibleTo(OutputForm) if argument is of that category.
+ (BinaryRecursiveAggregate): Weaken condition for coercion to
+ OutputForm.
+ (OneDimensionalArrayAggregate): Likewise.
+ (Tuple): Likewise.
+ (IndexedList): Likewise.
+ * tree.spad.pamphlet: Likewise.
+
2007-10-10 Gabriel Dos Reis <gdr@cs.tamu.edu>
* Makefile.pamphlet (INTERPSYS): Now take system root directory
diff --git a/src/algebra/aggcat.spad.pamphlet b/src/algebra/aggcat.spad.pamphlet
index 1363c020..e6163807 100644
--- a/src/algebra/aggcat.spad.pamphlet
+++ b/src/algebra/aggcat.spad.pamphlet
@@ -86,6 +86,7 @@ Aggregate: Category == Type with
++ Those with attribute \spadatt{shallowlyMutable} allow an element
++ to be modified or updated without changing its overall value.
HomogeneousAggregate(S:Type): Category == Aggregate with
+ if S has CoercibleTo(OutputForm) then CoercibleTo(OutputForm)
if S has SetCategory then SetCategory
if S has SetCategory then
if S has Evalable S then Evalable S
@@ -136,6 +137,7 @@ HomogeneousAggregate(S:Type): Category == Aggregate with
member?(e, c) == any?(e = #1,c)
x = y ==
size?(x, #y) and _and/[a = b for a in parts x for b in parts y]
+ if S has CoercibleTo(OutputForm) then
coerce(x:%):OutputForm ==
bracket
commaSeparate [a::OutputForm for a in parts x]$List(OutputForm)
@@ -1502,18 +1504,18 @@ BinaryRecursiveAggregate(S:Type):Category == RecursiveAggregate S with
x = value u => true
member?(x,left u) or member?(x,right u)
- if S has SetCategory then
+ if S has CoercibleTo(OutputForm) then
coerce(t:%): OutputForm ==
empty? t => "[]"::OutputForm
v := value(t):: OutputForm
empty? left t =>
empty? right t => v
- r := coerce(right t)@OutputForm
+ r := (right t)::OutputForm
bracket ["."::OutputForm, v, r]
- l := coerce(left t)@OutputForm
+ l := (left t)::OutputForm
r :=
empty? right t => "."::OutputForm
- coerce(right t)@OutputForm
+ (right t)::OutputForm
bracket [l, v, r]
if % has finiteAggregate then
@@ -2549,6 +2551,11 @@ OneDimensionalArrayAggregate(S:Type): Category ==
copyInto_!(z, y, i + #x)
z
+ if S has CoercibleTo(OutputForm) then
+ coerce(r:%):OutputForm ==
+ bracket commaSeparate
+ [qelt(r, k)::OutputForm for k in minIndex r .. maxIndex r]
+
if S has SetCategory then
x = y ==
#x ^= #y => false
@@ -2556,10 +2563,6 @@ OneDimensionalArrayAggregate(S:Type): Category ==
not(qelt(x, i) = qelt(y, i)) => return false
true
- coerce(r:%):OutputForm ==
- bracket commaSeparate
- [qelt(r, k)::OutputForm for k in minIndex r .. maxIndex r]
-
position(x:S, t:%, s:Integer) ==
n := maxIndex t
s < minIndex t or s > n => error "index out of range"
diff --git a/src/algebra/array1.spad.pamphlet b/src/algebra/array1.spad.pamphlet
index 0812a849..9b05dab0 100644
--- a/src/algebra/array1.spad.pamphlet
+++ b/src/algebra/array1.spad.pamphlet
@@ -138,6 +138,7 @@ Tuple(S:Type): CoercibleTo(PrimitiveArray S) with
++ tuples are 0-based
length: % -> NonNegativeInteger
++ length(x) returns the number of elements in tuple x
+ if S has CoercibleTo(OutputForm) then CoercibleTo(OutputForm)
if S has SetCategory then SetCategory
== add
Rep := Record(len : NonNegativeInteger, elts : PrimitiveArray S)
@@ -152,6 +153,7 @@ Tuple(S:Type): CoercibleTo(PrimitiveArray S) with
if S has SetCategory then
x = y == (x.len = y.len) and (x.elts =$PrimitiveArray(S) y.elts)
+ if S has CoercibleTo(OutputForm) then
coerce(x : %): OutputForm ==
paren [(x.elts.i)::OutputForm
for i in minIndex x.elts .. maxIndex x.elts]$List(OutputForm)
diff --git a/src/algebra/list.spad.pamphlet b/src/algebra/list.spad.pamphlet
index d773bb61..3e485db6 100644
--- a/src/algebra/list.spad.pamphlet
+++ b/src/algebra/list.spad.pamphlet
@@ -97,7 +97,7 @@ IndexedList(S:Type, mn:Integer): Exports == Implementation where
x := Qrest x
(NREVERSE(y)$Lisp)@%
- if S has SetCategory then
+ if S has CoercibleTo(OutputForm) then
coerce(x):OutputForm ==
-- displays cycle with overbar over the cycle
y := empty()$List(OutputForm)
@@ -114,6 +114,7 @@ IndexedList(S:Type, mn:Integer): Exports == Implementation where
z := concat((first x)::OutputForm, z)
bracket concat_!(y, overbar commaSeparate reverse_! z)
+ if S has SetCategory then
x = y ==
Qeq(x,y) => true
while not Qnull x and not Qnull y repeat
diff --git a/src/algebra/tree.spad.pamphlet b/src/algebra/tree.spad.pamphlet
index ff8ba34c..5a82ba59 100644
--- a/src/algebra/tree.spad.pamphlet
+++ b/src/algebra/tree.spad.pamphlet
@@ -182,7 +182,7 @@ Tree(S: SetCategory): T==C where
insert: (%, List %) -> List %
-----> coerce to OutputForm
- if S has SetCategory then
+ if S has CoercibleTo(OutputForm) then
multipleOverbar: (OutputForm, Integer, List %) -> OutputForm
coerce1: (%, List %, List %) -> OutputForm