aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ChangeLog5
-rw-r--r--src/algebra/aggcat.spad.pamphlet47
2 files changed, 36 insertions, 16 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index e9dd5d4b..d525a5a9 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,10 @@
2010-06-12 Gabriel Dos Reis <gdr@cs.tamu.edu>
+ * algebra/aggcat.spad.pamphlet (OneDimensionalArrayAggregate)
+ [merge,insert,delete]: Tidy.
+
+2010-06-12 Gabriel Dos Reis <gdr@cs.tamu.edu>
+
* interp/compiler.boot (complainIfShadowing): New.
(compStepIterator): Use it to warn about loop variable shadowing
declaration in enclosing scope.
diff --git a/src/algebra/aggcat.spad.pamphlet b/src/algebra/aggcat.spad.pamphlet
index 4f9ebe62..3f4b4783 100644
--- a/src/algebra/aggcat.spad.pamphlet
+++ b/src/algebra/aggcat.spad.pamphlet
@@ -2086,16 +2086,23 @@ OneDimensionalArrayAggregate(S:Type): Category ==
m := maxIndex a
j := minIndex b
n := maxIndex b
- k : Integer
- for k in minIndex(r).. while i <= m and j <= n repeat
+ k := minIndex(r)
+ while i <= m and j <= n repeat
if f(qelt(a, i), qelt(b, j)) then
qsetelt!(r, k, qelt(a, i))
i := i+1
else
qsetelt!(r, k, qelt(b, j))
j := j+1
- for k in k.. for i in i..m repeat qsetelt!(r, k, elt(a, i))
- for k in k.. for j in j..n repeat qsetelt!(r, k, elt(b, j))
+ k := k + 1
+ while i <= m repeat
+ qsetelt!(r, k, elt(a, i))
+ k := k + 1
+ i := i + 1
+ while j <= n repeat
+ qsetelt!(r, k, elt(b, j))
+ k := k + 1
+ j := j + 1
r
elt(a:%, s:UniversalSegment(Integer)) ==
@@ -2112,12 +2119,16 @@ OneDimensionalArrayAggregate(S:Type): Category ==
n := maxIndex b
i < m or i > n => error "index out of range"
y := stupidnew(#a + #b, a, b)
- k : Integer
- for k in minIndex y.. for j in m..i-1 repeat
+ k := minIndex y
+ for j in m..i-1 repeat
qsetelt!(y, k, qelt(b, j))
- for k in k.. for j in minIndex a .. maxIndex a repeat
+ k := k + 1
+ for j in minIndex a .. maxIndex a repeat
qsetelt!(y, k, qelt(a, j))
- for k in k.. for j in i..n repeat qsetelt!(y, k, qelt(b, j))
+ k := k + 1
+ for j in i..n repeat
+ qsetelt!(y, k, qelt(b, j))
+ k := k + 1
y
copy x ==
@@ -2145,21 +2156,25 @@ OneDimensionalArrayAggregate(S:Type): Category ==
l < minIndex a or h > maxIndex a => error "index out of range"
h < l => copy a
r := stupidnew((#a - h + l - 1)::NonNegativeInteger, a, a)
- k : Integer
- for k in minIndex(r).. for i in minIndex a..l-1 repeat
+ k := minIndex(r)
+ for i in minIndex a..l-1 repeat
qsetelt!(r, k, qelt(a, i))
- for k in k.. for i in h+1 .. maxIndex a repeat
+ k := k + 1
+ for i in h+1 .. maxIndex a repeat
qsetelt!(r, k, qelt(a, i))
+ k := k + 1
r
delete(x:%, i:Integer) ==
i < minIndex x or i > maxIndex x => error "index out of range"
y := stupidnew((#x - 1)::NonNegativeInteger, x, x)
- i : Integer
- for i in minIndex(y).. for j in minIndex x..i-1 repeat
- qsetelt!(y, i, qelt(x, j))
- for i in i .. for j in i+1 .. maxIndex x repeat
- qsetelt!(y, i, qelt(x, j))
+ k := minIndex y
+ for j in minIndex x..i-1 repeat
+ qsetelt!(y, k, qelt(x, j))
+ k := k + 1
+ for j in i+1 .. maxIndex x repeat
+ qsetelt!(y, k, qelt(x, j))
+ k := k + 1
y
reverse! x ==