aboutsummaryrefslogtreecommitdiff
path: root/src/algebra/aggcat.spad.pamphlet
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2008-05-11 19:14:29 +0000
committerdos-reis <gdr@axiomatics.org>2008-05-11 19:14:29 +0000
commit20e1bed66399cce629d08a71ca0552ed24fef1d1 (patch)
tree000ab5b98e479d1c077fc4f6fd4a9f46c4a9451c /src/algebra/aggcat.spad.pamphlet
parent51422a0c6bc0128cd5635a01c402ef56ad4ed770 (diff)
downloadopen-axiom-20e1bed66399cce629d08a71ca0552ed24fef1d1.tar.gz
Restrict loop variable scopes, take 2.
* interp/iterator.boot (compReduce1): Maintain proper scope for loop variables. (compRepeatOrCollect): Really maintain proper scope for loop variables. * interp/compiler.boot (eltModemapFilter): Highlight faulty selector. (seteltModemapFilter): Likewise. * interp/c-util.boot (stackMessage): Don't build message if there is no argument for substitution. * algebra/aggcat.spad.pamphlet (#$UnaryRecursiveAggregate): Declare free loop variable. (cycleEntry$UnaryRecursiveAggregate): Likewise. (cycleLength): Likewise. (merge$OneDimensionalArrayAggregate): Likewise. (delete$OneDimensionalArrayAggregate): Likewise. (position$ListAggregate): Likewise. * algebra/array1.spad.pamphlet (merge!$IndexedFlexibleArray): Likewise. * algebra/combfunc.spad.pamphlet (K2fact$CombinatorialFunction): Likewise. * algebra/curve.spad.pamphlet (nonSingularModel$FunctionFieldCategory): Likewise. * algebra/dpolcat.spad.pamphlet (differentiate$DifferentialPolynomialCategory): Likewise. * algebra/efstruc.spad.pamphlet (validExponential$ElementaryFunctionStructurePackage): Likewise. (ker2explogs$InnerTrigonometricManipulations): Likewise. (complexNormalize$TrigonometricManipulations): Likewise.
Diffstat (limited to 'src/algebra/aggcat.spad.pamphlet')
-rw-r--r--src/algebra/aggcat.spad.pamphlet9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/algebra/aggcat.spad.pamphlet b/src/algebra/aggcat.spad.pamphlet
index a308f1e6..af724ec4 100644
--- a/src/algebra/aggcat.spad.pamphlet
+++ b/src/algebra/aggcat.spad.pamphlet
@@ -2507,6 +2507,7 @@ UnaryRecursiveAggregate(S:Type): Category == RecursiveAggregate S with
empty? l and zero? i
#x ==
+ k : NonNegativeInteger
for k in 0.. while not empty? x repeat
k = cycleMax and cyclic? x => error "cyclic list"
x := rest x
@@ -2541,6 +2542,7 @@ UnaryRecursiveAggregate(S:Type): Category == RecursiveAggregate S with
empty? x => x
empty?(y := findCycle x) => y
z := rest y
+ l : NonNegativeInteger
for l in 1.. while not eq?(y,z) repeat z := rest z
y := x
for k in 1..l repeat y := rest y
@@ -2551,6 +2553,7 @@ UnaryRecursiveAggregate(S:Type): Category == RecursiveAggregate S with
empty? x => 0
empty?(x := findCycle x) => 0
y := rest x
+ k : NonNegativeInteger
for k in 1.. while not eq?(x,y) repeat y := rest y
k
@@ -4286,6 +4289,7 @@ 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
if f(qelt(a, i), qelt(b, j)) then
qsetelt_!(r, k, qelt(a, i))
@@ -4311,6 +4315,7 @@ 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
qsetelt_!(y, k, qelt(b, j))
for k in k.. for j in minIndex a .. maxIndex a repeat
@@ -4343,6 +4348,7 @@ 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
qsetelt_!(r, k, qelt(a, i))
for k in k.. for i in h+1 .. maxIndex a repeat
@@ -4352,6 +4358,7 @@ OneDimensionalArrayAggregate(S:Type): Category ==
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
@@ -4586,6 +4593,7 @@ ListAggregate(S:Type): Category == Join(StreamAggregate S,
first x
position(f:S -> Boolean, x:%) ==
+ k : Integer
for k in minIndex(x).. while not empty? x and not f first x repeat
x := rest x
empty? x => minIndex(x) - 1
@@ -4679,6 +4687,7 @@ ListAggregate(S:Type): Category == Join(StreamAggregate S,
position(w, x, s) ==
s < (m := minIndex x) => error "index out of range"
x := rest(x, (s - m)::NonNegativeInteger)
+ k : Integer
for k in s.. while not empty? x and w ~= first x repeat
x := rest x
empty? x => minIndex x - 1