A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.lispworks.com/documentation/lw71/LW/html/lw-404.htm below:

make-hash-table

Arguments

test

A designator for a function of two arguments, which returns t if they should be regarded as the same and nil otherwise.

hash-function

A designator for a function of one argument, which returns a hash value.

weak-kind

t, nil, or one of the keywords :value, :key, :both, :one and :either.

single-thread

A generalized boolean.

free-function

A designator for a function of two arguments.

Description

The standard definition of make-hash-table is extended such that test can be any suitable user-defined function, except that it must not call process-wait or similar mp package functions which suspend the current process. If test is not one of the standard test functions (eq, eql, equal and equalp), and if hash-function is not supplied, then the hash value is the same as would be used if test were equalp.

hash-function may be supplied only if test is not one of the standard test functions. It takes a hash key as its argument and returns a hash value to use for hashing.

If weak-kind is non-nil, it makes hash-table weak. Its semantics are the same as the second argument of set-hash-table-weak, that is:

(make-hash-table :weak-kind weak-kind <other-args>)

is equivalent to

(let ((ht (make-hash-table <other-args>
)))
  (set-hash-table-weak ht weak-kind
)
  ht)

The default value of weak-kind is nil.

single-thread, if true, tells make-hash-table that the table is going to be used only in single thread contexts, and therefore does not need to be thread-safe. Single thread context means that only one thread can access the table at any point in time. That may be because the table is used only in one thread, but it can also be the case if the table is only ever accessed in the scope of a lock. Making a table with single-thread makes access to this table faster, but not thread-safe. It does not have other effects. The default value of single-thread is nil.

free-function adds a "free action" for a weak hash table. This has an effect only if make-hash-table is called with weak-kind non-nil. The free-function is called after an entry is automatically removed by the garbage collector (GC). If weak-kind is nil, free-function is ignored.

free-function, if supplied, must take two arguments: key and value. When an entry is removed from a weak table hash-table because the relevant object is not pointed by any other object, the key and the value are remembered. Some time later (normally short, but not well-defined) the free-function is called with key and value as its arguments.

free-function needs to be fast, to avoid delays in unexpected places. Otherwise there are no restrictions on what free-function does. In particular, it can keep the key or value alive by storing them somewhere.

When objects are removed from the table by explicit calls (remhash, clrhash, (setf gethash)), free-function is not called.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4