aboutsummaryrefslogtreecommitdiff
path: root/src/algebra/string.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/string.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/string.spad.pamphlet')
-rw-r--r--src/algebra/string.spad.pamphlet10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/algebra/string.spad.pamphlet b/src/algebra/string.spad.pamphlet
index 09adfaf7..d5b13181 100644
--- a/src/algebra/string.spad.pamphlet
+++ b/src/algebra/string.spad.pamphlet
@@ -468,6 +468,7 @@ IndexedString(mn:Integer): Export == Implementation where
h:I := if hasHi sg then hi(sg) - mn else maxIndex s - mn
l < 0 or h >= m or h < l-1 => error "index out of range"
r := new((m-(h-l+1)+n)::N, space$C)
+ k : NonNegativeInteger
for k in 0.. for i in 0..l-1 repeat Qsetelt(r, k, Qelt(s, i))
for k in k.. for i in 0..n-1 repeat Qsetelt(r, k, Qelt(t, i))
for k in k.. for i in h+1..m-1 repeat Qsetelt(r, k, Qelt(s, i))
@@ -512,6 +513,7 @@ IndexedString(mn:Integer): Export == Implementation where
split(s, c) ==
n := maxIndex s
+ i : NonNegativeInteger
for i in mn..n while s.i = c repeat 0
l := empty()$List(%)
j:Integer -- j is conditionally intialized
@@ -520,8 +522,10 @@ IndexedString(mn:Integer): Export == Implementation where
for i in j..n while s.i = c repeat 0
if i <= n then l := concat(s(i..n), l)
reverse_! l
+
split(s, cc) ==
n := maxIndex s
+ i : NonNegativeInteger
for i in mn..n while member?(s.i,cc) repeat 0
l := empty()$List(%)
j:Integer -- j is conditionally intialized
@@ -533,17 +537,23 @@ IndexedString(mn:Integer): Export == Implementation where
leftTrim(s, c) ==
n := maxIndex s
+ i : NonNegativeInteger
for i in mn .. n while s.i = c repeat 0
s(i..n)
+
leftTrim(s, cc) ==
n := maxIndex s
+ i : NonNegativeInteger
for i in mn .. n while member?(s.i,cc) repeat 0
s(i..n)
rightTrim(s, c) ==
+ j : NonNegativeInteger
for j in maxIndex s .. mn by -1 while s.j = c repeat 0
s(minIndex(s)..j)
+
rightTrim(s, cc) ==
+ j : NonNegativeInteger
for j in maxIndex s .. mn by -1 while member?(s.j, cc) repeat 0
s(minIndex(s)..j)