aboutsummaryrefslogtreecommitdiff
path: root/src/algebra/kl.spad.pamphlet
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2009-05-14 06:48:36 +0000
committerdos-reis <gdr@axiomatics.org>2009-05-14 06:48:36 +0000
commit83b8aa234c1734f0533f0665cb9fe96a14730727 (patch)
tree402f0f3a62ed3be6a3a090a10815f9817b6e2698 /src/algebra/kl.spad.pamphlet
parent4e9fb64d1d46a085eb66e90a13846b44f251efde (diff)
downloadopen-axiom-83b8aa234c1734f0533f0665cb9fe96a14730727.tar.gz
* algebra/kl.spad.pamphlet (SortedCache): Use Reference List S.
Diffstat (limited to 'src/algebra/kl.spad.pamphlet')
-rw-r--r--src/algebra/kl.spad.pamphlet13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/algebra/kl.spad.pamphlet b/src/algebra/kl.spad.pamphlet
index f9b26e86..b2ba8cad 100644
--- a/src/algebra/kl.spad.pamphlet
+++ b/src/algebra/kl.spad.pamphlet
@@ -58,12 +58,13 @@ SortedCache(S:CachableSet): Exports == Implementation where
++ It returns x with an integer associated with it.
Implementation ==> add
+ import Reference List S
shiftCache : (List S, N) -> Void
insertInCache: (List S, List S, S, N) -> S
- cach := [nil()]$Record(cche:List S)
+ cach := ref(nil$List(S))
- cache() == cach.cche
+ cache() == deref cach
shiftCache(l, n) ==
for x in l repeat setPosition(x, n + position x)
@@ -71,7 +72,7 @@ SortedCache(S:CachableSet): Exports == Implementation where
clearCache() ==
for x in cache repeat setPosition(x, 0)
- cach.cche := nil()
+ setref(cach,nil$List(S))
void
enterInCache(x:S, equal?:S -> Boolean) ==
@@ -82,7 +83,7 @@ SortedCache(S:CachableSet): Exports == Implementation where
return y
scan := rest scan
setPosition(x, 1 + #cache())
- cach.cche := concat(cache(), x)
+ setref(cach,concat(cache(), x))
x
enterInCache(x:S, triage:(S, S) -> Integer) ==
@@ -96,13 +97,13 @@ SortedCache(S:CachableSet): Exports == Implementation where
scan := rest scan
pos := position y
setPosition(x, pos + DIFF)
- cach.cche := concat(cache(), x)
+ setref(cach, concat(cache(), x))
x
insertInCache(before, after, x, pos) ==
if ((pos+1) = position first after) then shiftCache(after, DIFF)
setPosition(x, pos + (((position first after) - pos)::N quo 2))
- cach.cche := concat(before, concat(x, after))
+ setref(cach, concat(before, concat(x, after)))
x
@