Structural Informatics Group (SIG) logo
Home | Projects | Demos | Downloads | Publications | Local Info | About Us | New site
Go to the first, previous, next, last section, table of contents.

hash

hash

type: function (subr) 
location: built-in
source file: xlbfun.c  and  xlsym.c
Common LISP compatible: no
supported on: all machines

SYNTAX

(hash <name> <table-size> )
        <name>          -       a symbol or string expression
        <table-size>    -       an integer expression 

DESCRIPTION

The HASH function computes and returns an integer index for a given symbol <name> and a given size of hash table <table-size>. The intention is for HASH to be used with tables made by MAKE-ARRAY and accessed by AREF.

EXAMPLES

(hash "zzzz" 1000)                      ; returns index 322
(hash "ZZZZ" 1000)                      ; returns index 626
(hash 'ZZZZ  1000)                      ; returns index 626
(hash "hiho" 1000)                      ; returns index 519
(hash 'hiho  1000)                      ; returns index 143
(hash "abcd" 1000)                      ; returns index 72
(defun lookin (sym)                     ; create a function to 
   (aref *obarray*                      ;   look inside *OBARRAY*
         (hash sym (length *obarray*))));   and look for a specific
                                        ;   symbol - returns a list
(lookin 'caar)                          ; returns the hash table entry
                                        ;   (ZEROP CDDDDR CAAR HASH)

NOTE: This is a useful function for creating and accessing tables. It is also useful for looking inside of XLISP's own symbol table *OBARRAY*.


Go to the first, previous, next, last section, table of contents.