version 1.36, 2007/12/31 18:40:24
|
version 1.40, 2009/12/31 15:32:35
|
Line 1
|
Line 1
|
\ Hashed dictionaries 15jul94py |
\ Hashed dictionaries 15jul94py |
|
|
\ Copyright (C) 1995,1998,2000,2003,2006 Free Software Foundation, Inc. |
\ Copyright (C) 1995,1998,2000,2003,2006,2007,2009 Free Software Foundation, Inc. |
|
|
\ This file is part of Gforth. |
\ This file is part of Gforth. |
|
|
Line 172 const Create (hashsearch-map)
|
Line 172 const Create (hashsearch-map)
|
\ Hash-Find 01jan93py |
\ Hash-Find 01jan93py |
has? cross 0= |
has? cross 0= |
[IF] |
[IF] |
|
: hash-wordlist ( wid -- ) |
|
hashsearch-map swap wordlist-map ! ; |
: make-hash |
: make-hash |
hashsearch-map forth-wordlist wordlist-map ! |
forth-wordlist hash-wordlist |
|
environment-wordlist hash-wordlist |
|
['] Root >body hash-wordlist |
addall ; |
addall ; |
make-hash \ Baumsuche ist installiert. |
make-hash \ Baumsuche ist installiert. |
[ELSE] |
[ELSE] |
Line 225 has? cross 0=
|
Line 229 has? cross 0=
|
\ : chisq ( -- n ) |
\ : chisq ( -- n ) |
\ \ n should have about the same size as Hashlen |
\ \ n should have about the same size as Hashlen |
\ countwl Hashlen 2 pick */ swap - ; |
\ countwl Hashlen 2 pick */ swap - ; |
|
|
|
\ Create hashhist here $100 cells dup allot erase |
|
|
|
\ : .hashhist ( -- ) hashhist $100 cells erase |
|
\ HashTable HashLen cells bounds |
|
\ DO 0 I BEGIN @ dup WHILE swap 1+ swap REPEAT drop |
|
\ 1 swap cells hashhist + +! |
|
\ cell +LOOP |
|
\ 0 0 $100 0 DO |
|
\ hashhist I cells + @ dup IF |
|
\ cr I 0 .r ." : " dup . THEN tuck I * + >r + r> |
|
\ LOOP cr ." Total: " 0 .r ." /" . cr ; |