aboutsummaryrefslogtreecommitdiff
path: root/src/algebra/defaults.spad.pamphlet
diff options
context:
space:
mode:
Diffstat (limited to 'src/algebra/defaults.spad.pamphlet')
-rw-r--r--src/algebra/defaults.spad.pamphlet18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/algebra/defaults.spad.pamphlet b/src/algebra/defaults.spad.pamphlet
index b50fee54..9f9bf356 100644
--- a/src/algebra/defaults.spad.pamphlet
+++ b/src/algebra/defaults.spad.pamphlet
@@ -116,8 +116,8 @@ FiniteLinearAggregateSort(S, V): Exports == Implementation where
while (j := 2*i+1) < n repeat
if (k := j+1) < n and l(qelt(r, j), qelt(r, k)) then j := k
if l(t,qelt(r,j)) then
- qsetelt_!(r, i, qelt(r, j))
- qsetelt_!(r, j, t)
+ qsetelt!(r, i, qelt(r, j))
+ qsetelt!(r, j, t)
i := j
else leave
@@ -126,7 +126,7 @@ FiniteLinearAggregateSort(S, V): Exports == Implementation where
n := (#r)::I
for k in shift(n,-1) - 1 .. 0 by -1 repeat siftUp(l, r, k, n)
for k in n-1 .. 1 by -1 repeat
- swap_!(r, 0, k)
+ swap!(r, 0, k)
siftUp(l, r, 0, k)
r
@@ -134,19 +134,19 @@ FiniteLinearAggregateSort(S, V): Exports == Implementation where
-- partition r[i..j] such that r.s <= r.k <= r.t
x := qelt(r, k)
t := qelt(r, i)
- qsetelt_!(r, k, qelt(r, j))
+ qsetelt!(r, k, qelt(r, j))
while i < j repeat
if l(x,t) then
- qsetelt_!(r, j, t)
+ qsetelt!(r, j, t)
j := j-1
- t := qsetelt_!(r, i, qelt(r, j))
+ t := qsetelt!(r, i, qelt(r, j))
else (i := i+1; t := qelt(r, i))
- qsetelt_!(r, j, x)
+ qsetelt!(r, j, x)
j
QuickSort(l, r, i, j) ==
n := j - i
- if one? n and l(qelt(r, j), qelt(r, i)) then swap_!(r, i, j)
+ if one? n and l(qelt(r, j), qelt(r, i)) then swap!(r, i, j)
n < 2 => return r
-- for the moment split at the middle item
k := partition(l, r, i, j, i + shift(n,-1))
@@ -164,7 +164,7 @@ FiniteLinearAggregateSort(S, V): Exports == Implementation where
for i in m+g..n repeat
j := i-g
while j >= m and l(qelt(r, j+g), qelt(r, j)) repeat
- swap_!(r,j,j+g)
+ swap!(r,j,j+g)
j := j-g
g := g quo 3
r