aboutsummaryrefslogtreecommitdiff
path: root/src/algebra/array1.spad.pamphlet
diff options
context:
space:
mode:
Diffstat (limited to 'src/algebra/array1.spad.pamphlet')
-rw-r--r--src/algebra/array1.spad.pamphlet14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/algebra/array1.spad.pamphlet b/src/algebra/array1.spad.pamphlet
index 92feee53..0a521e77 100644
--- a/src/algebra/array1.spad.pamphlet
+++ b/src/algebra/array1.spad.pamphlet
@@ -272,21 +272,21 @@ IndexedFlexibleArray(S:Type, mn: Integer): Exports == Implementation where
delete!(r:%, i1:I) ==
i := i1 - mn
- i < 0 or i > r.logLen => error "index out of range"
+ negative? i or i > r.logLen => error "index out of range"
for k in i..r.logLen-2 repeat r.f.k := r.f.(k+1)
shrink(r, 1)
delete!(r:%, i:U) ==
l := lo i - mn; m := maxIndex r - mn
h := (hasHi i => hi i - mn; m)
- l < 0 or h > m => error "index out of range"
+ negative? l or h > m => error "index out of range"
for j in l.. for k in h+1..m repeat r.f.j := r.f.k
shrink(r, max(0,h-l+1))
insert!(x:S, r:%, i1:I):% ==
i := i1 - mn
n := r.logLen
- i < 0 or i > n => error "index out of range"
+ negative? i or i > n => error "index out of range"
growAndFill(r, 1, x)
for k in n-1 .. i by -1 repeat r.f.(k+1) := r.f.k
r.f.i := x
@@ -296,7 +296,7 @@ IndexedFlexibleArray(S:Type, mn: Integer): Exports == Implementation where
i := i1 - mn
if eq?(a, b) then b := copy b
m := #a; n := #b
- i < 0 or i > n => error "index out of range"
+ negative? i or i > n => error "index out of range"
growAdding(b, m, a)
for k in n-1 .. i by -1 repeat b.f.(m+k) := b.f.k
for k in m-1 .. 0 by -1 repeat b.f.(i+k) := a.f.k
@@ -394,20 +394,20 @@ IndexedOneDimensionalArray(S:Type, mn:Integer):
map!(f, s1) ==
n: Integer := Qmax(s1)
- n < 0 => s1
+ negative? n => s1
for i in 0..n repeat Qsetelt(s1, i, f(%aref(s1,i)))
s1
map(f, s1) ==
n:Integer := Qmax(s1)
- n < 0 => s1
+ negative? n => s1
ss2:% := newArray(n+1)
for i in 0..n repeat Qsetelt(ss2, i, f(%aref(s1,i)))
ss2
map(f, a, b) ==
maxind:Integer := min(Qmax a, Qmax b)
- maxind < 0 => empty()
+ negative? maxind => empty()
c:% := newArray(maxind+1)
for i in 0..maxind repeat
Qsetelt(c, i, f(%aref(a,i),%aref(b,i)))