diff options
Diffstat (limited to 'src/interp/sys-utility.boot')
-rw-r--r-- | src/interp/sys-utility.boot | 25 |
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 |