* WHERE-IS library doc * Gather keyboard files, add VIRTUAL.TEDIT * add UNIXCOMM.TEDIT * rest of TEdit library files * save table of contents index for reworking * Don't move around VIRTUALKEYBOARDS files; will move in separate commit * Add MATMULT from Envos/Medley
181 lines
27 KiB
Plaintext
181 lines
27 KiB
Plaintext
1
|
||
|
||
Lisp Library Modules, Medley Release 1.0, HASH-FILE
|
||
1
|
||
|
||
Lisp Library Modules, Medley Release 1.0, HASH-FILE
|
||
HASH-FILE
|
||
1
|
||
|
||
HASH-FILE
|
||
1
|
||
|
||
|
||
HASH-FILE
|
||
6
|
||
|
||
Hash-File(HASH-FILE NIL Hash-File NIL NIL 133) is similar to but not compatible with the library module, Hash. Hash-File is modeled after the Common Lisp hash table facility, and Hash was modeled after the Interlisp hash array facility.
|
||
Hash files, like hash tables, are objects which efficiently map from a given Lisp object, called the key, to another Lisp object, called the value. Hash tables store this mapping in memory, while hash files store the mapping in a specially formatted file. Hash files are generally slower to access than hash tables, but they do not absorb memory and they are persistent over Lisp images. Hash files are recommended for large databases which do not change very often.
|
||
Since hash files are not stored in memory, hashing for EQ or EQL keys does not make sense. Memory references written to file in one session will probably not be valid in another. For this reason, the default hashing is for EQUAL keys, and then only those which can be dependably printed and read.
|
||
All of the code for Hash-File is in a package called Hash-File. Througout this document Lisp symbols are printed as though in a package which uses the packages Hash-File and Lisp.
|
||
Requirements
|
||
1
|
||
|
||
Hash files must reside on a random-access device (not a TCP/IP file server).
|
||
Installation
|
||
1
|
||
|
||
Load HASH-FILE.DFASL from the Library.
|
||
Functions
|
||
1
|
||
|
||
Hash-File has functions to create a new hash file, to open and close existing hash files, and to store and retrieve data in hash files.
|
||
Creating a Hash File
|
||
(make-hash-file(MAKE-HASH-FILE (Function) make-hash-file NIL NIL 133) file-name size &key . keys) [Function]
|
||
Creates and returns a new hash file in file-name opened for input and output. Size indicates the table size and should be an integer somewhat larger than the maximum number of keys under which you expect to store values in this hash file. (The hash file grows as required, so this number need not be accurate. See the section , "Rehashing," below.) The keyword arguments are explained as this document progresses.
|
||
Opening and Closing Hash Files
|
||
(open-hash-file (OPEN-HASH-FILE (Function) open-hash-file NIL NIL 133) file-name &key :direction . other-keys ) [Function]
|
||
Opens an existing hash file and returns it. The :direction argument must be one of :input or :io. If opened for :in put then storing values in the hash file is disallowed. The default for :direction is :input. Other key arguments are the same as for make-hash-file and are explained as this document progresses.
|
||
(close-hash-file (CLOSE-HASH-FILE (Function) close-hash-file NIL NIL 134) hash-file) [Function]
|
||
Closes the file for hash-file, ensuring that all data has been saved. The backing file is always kept coherent; thus t<><74> |