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.pamphlet44
1 files changed, 22 insertions, 22 deletions
diff --git a/src/algebra/array1.spad.pamphlet b/src/algebra/array1.spad.pamphlet
index 00117332..df4c2205 100644
--- a/src/algebra/array1.spad.pamphlet
+++ b/src/algebra/array1.spad.pamphlet
@@ -153,7 +153,7 @@ IndexedFlexibleArray(S:Type, mn: Integer): Exports == Implementation where
++ flexibleArray(l) creates a flexible array from the list of elements l
physicalLength : % -> NonNegativeInteger
++ physicalLength(x) returns the number of elements x can accomodate before growing
- physicalLength_!: (%, I) -> %
+ physicalLength!: (%, I) -> %
++ physicalLength!(x,n) changes the physical length of x to be n and returns the new array.
shrinkable: Boolean -> Boolean
++ shrinkable(b) sets the shrinkable attribute of flexible arrays to b and returns the previous value
@@ -167,13 +167,13 @@ IndexedFlexibleArray(S:Type, mn: Integer): Exports == Implementation where
newa : (N, A) -> A
physicalLength(r) == (r.physLen) pretend NonNegativeInteger
- physicalLength_!(r, n) ==
+ physicalLength!(r, n) ==
r.physLen = 0 => error "flexible array must be non-empty"
growWith(r, n, r.f.0)
empty() == [0, 0, empty()]
#r == (r.logLen)::N
- fill_!(r, x) == (fill_!(r.f, x); r)
+ fill!(r, x) == (fill!(r.f, x); r)
maxIndex r == r.logLen - 1 + mn
minIndex r == mn
new(n, a) == [n, n, new(n, a)]
@@ -249,40 +249,40 @@ IndexedFlexibleArray(S:Type, mn: Integer): Exports == Implementation where
r.f.(i-mn) := x
-- operations inherited from extensible aggregate
- merge(g, a, b) == merge_!(g, copy a, b)
- concat(x:S, r:%) == insert_!(x, r, mn)
+ merge(g, a, b) == merge!(g, copy a, b)
+ concat(x:S, r:%) == insert!(x, r, mn)
- concat_!(r:%, x:S) ==
+ concat!(r:%, x:S) ==
growAndFill(r, 1, x)
r.f.(r.logLen-1) := x
r
- concat_!(a:%, b:%) ==
+ concat!(a:%, b:%) ==
if eq?(a, b) then b := copy b
n := #a
growAdding(a, #b, b)
- copyInto_!(a, b, n + mn)
+ copyInto!(a, b, n + mn)
- remove_!(g:(S->Boolean), a:%) ==
+ remove!(g:(S->Boolean), a:%) ==
k:I := 0
for i in 0..maxIndex a - mn repeat
if not g(a.i) then (a.k := a.i; k := k+1)
shrink(a, #a - k)
- delete_!(r:%, i1:I) ==
+ delete!(r:%, i1:I) ==
i := i1 - mn
i < 0 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) ==
+ 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"
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):% ==
+ insert!(x:S, r:%, i1:I):% ==
i := i1 - mn
n := r.logLen
i < 0 or i > n => error "index out of range"
@@ -291,7 +291,7 @@ IndexedFlexibleArray(S:Type, mn: Integer): Exports == Implementation where
r.f.i := x
r
- insert_!(a:%, b:%, i1:I):% ==
+ insert!(a:%, b:%, i1:I):% ==
i := i1 - mn
if eq?(a, b) then b := copy b
m := #a; n := #b
@@ -301,7 +301,7 @@ IndexedFlexibleArray(S:Type, mn: Integer): Exports == Implementation where
for k in m-1 .. 0 by -1 repeat b.f.(i+k) := a.f.k
b
- merge_!(g, a, b) ==
+ merge!(g, a, b) ==
m := #a; n := #b; growAdding(a, n, b)
for i in m-1..0 by -1 for j in m+n-1.. by -1 repeat a.f.j := a.f.i
i := n; j := 0
@@ -312,13 +312,13 @@ IndexedFlexibleArray(S:Type, mn: Integer): Exports == Implementation where
for k in k.. for j in j..n-1 repeat a.f.k := b.f.j
a
- select_!(g:(S->Boolean), a:%) ==
+ select!(g:(S->Boolean), a:%) ==
k:I := 0
for i in 0..maxIndex a - mn repeat if g(a.f.i) then (a.f.k := a.f.i;k := k+1)
shrink(a, #a - k)
if S has SetCategory then
- removeDuplicates_! a ==
+ removeDuplicates! a ==
ct := #a
ct < 2 => a
@@ -332,7 +332,7 @@ IndexedFlexibleArray(S:Type, mn: Integer): Exports == Implementation where
j := j+1
nlim := j
i := i+1
- nlim ~= nlim0 => delete_!(a, i..)
+ nlim ~= nlim0 => delete!(a, i..)
a
@
@@ -410,7 +410,7 @@ IndexedOneDimensionalArray(S:Type, mn:Integer):
if zero? mn then
qelt(x, i) == Qelt(x, i)
- qsetelt_!(x, i, s) == Qsetelt(x, i, s)
+ qsetelt!(x, i, s) == Qsetelt(x, i, s)
elt(x:%, i:I) ==
negative? i or i > maxIndex(x) => error "index out of range"
@@ -418,12 +418,12 @@ IndexedOneDimensionalArray(S:Type, mn:Integer):
setelt(x:%, i:I, s:S) ==
negative? i or i > maxIndex(x) => error "index out of range"
- qsetelt_!(x, i, s)
+ qsetelt!(x, i, s)
else if one? mn then
maxIndex x == Qsize x
qelt(x, i) == Qelt(x, i-1)
- qsetelt_!(x, i, s) == Qsetelt(x, i-1, s)
+ qsetelt!(x, i, s) == Qsetelt(x, i-1, s)
elt(x:%, i:I) ==
QSLESSP(i,1$Lisp)$Lisp or QSLESSP(Qsize x,i)$Lisp =>
@@ -437,7 +437,7 @@ IndexedOneDimensionalArray(S:Type, mn:Integer):
else
qelt(x, i) == Qelt(x, i - mn)
- qsetelt_!(x, i, s) == Qsetelt(x, i - mn, s)
+ qsetelt!(x, i, s) == Qsetelt(x, i - mn, s)
elt(x:%, i:I) ==
i < mn or i > maxIndex(x) => error "index out of range"
@@ -445,7 +445,7 @@ IndexedOneDimensionalArray(S:Type, mn:Integer):
setelt(x:%, i:I, s:S) ==
i < mn or i > maxIndex(x) => error "index out of range"
- qsetelt_!(x, i, s)
+ qsetelt!(x, i, s)
@
\section{domain ARRAY1 OneDimensionalArray}