aboutsummaryrefslogtreecommitdiff
path: root/src/interp/sys-utility.boot
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2010-07-10 07:02:51 +0000
committerdos-reis <gdr@axiomatics.org>2010-07-10 07:02:51 +0000
commitbb7fb2ba39aee08afc943dbfa1ad9d375b8bb985 (patch)
tree0e86d2f22c2e9073a903b9c69ce6a3deae13df77 /src/interp/sys-utility.boot
parentd8eca6ec8ed4ebe3bba40af4f6534458e92b6633 (diff)
downloadopen-axiom-bb7fb2ba39aee08afc943dbfa1ad9d375b8bb985.tar.gz
* interp/sys-utility.boot (minimalise): Move from compress.boot.
Rewrite local worker to use explicit hash table parameter instead of special variable. * interp/compress.boot (minimalise): Move to sys-utility.boot. Delete file. * interp/nruncomp.boot (buildFunctor): Don't bother to minimalise.
Diffstat (limited to 'src/interp/sys-utility.boot')
-rw-r--r--src/interp/sys-utility.boot25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/interp/sys-utility.boot b/src/interp/sys-utility.boot
index e3e99724..8c22be2e 100644
--- a/src/interp/sys-utility.boot
+++ b/src/interp/sys-utility.boot
@@ -35,6 +35,7 @@
import sys_-os
import vmlisp
+import hash
namespace BOOT
module sys_-utility where
@@ -285,6 +286,30 @@ hashTable cmp ==
error '"bad arg to hashTable"
MAKE_-HASH_-TABLE(KEYWORD::TEST,testFun)
+--% Trees to Graphs
+
+minimalise x ==
+ min(x,hashTable 'EQUAL) where
+ min(x,ht) ==
+ y := HGET(ht,x)
+ y => y
+ cons? x =>
+ z := min(first x,ht)
+ if not EQ(z,first x) then x.first := z
+ z := min(rest x,ht)
+ if not EQ(z,rest x) then x.rest := z
+ hashCheck(x,ht)
+ REFVECP x =>
+ for i in 0..MAXINDEX x repeat
+ x.i := min(x.i,ht)
+ hashCheck(x,ht)
+ string? x => hashCheck(x,ht)
+ x
+ hashCheck(x,ht) ==
+ y := HGET(ht,x)
+ y => y
+ HPUT(ht,x,x)
+ x
--% File IO
$InputIOMode == KEYWORD::INPUT