GNU Info

Info Node: (librep.info)Obarrays

(librep.info)Obarrays


Next: Creating Symbols Prev: Symbol Attributes Up: Symbols
Enter node , (file) or (file)node

Obarrays
--------

   An "obarray" is the structure used to ensure that no two symbols
have the same name and to provide quick access to a symbol given its
name. An obarray is a vector, each element of the vector is a chain of
symbols whose names share the same hash-code (a "bucket"). These
symbols are chained together through links which are invisible to Lisp
programs: if you examine an obarray you will see that each bucket looks
as though it has at most one symbol stored in it.

   The normal way to reference a symbol is simply to type its name in
the program, when the Lisp reader encounters a name of a symbol it looks
in the default obarray for a symbol of that name. If the named symbol
doesn't exist it is created and hashed into the obarray--this process
is known as "interning" the symbol, for more details see Note:
Interning.

 - Variable: obarray
     This variable contains the obarray that the `read' function uses
     when interning symbols.

 - Function: make-obarray size
     This function creates a new obarray with SIZE hash buckets (this
     should probably be a prime number for the fewest hash collisions).

     This is the only way of creating an obarray. `make-vector' is _not
     suitable_.

 - Function: find-symbol symbol-name #!optional obarray
     This function scans the specified obarray (OBARRAY or the value of
     the variable `obarray' if OBARRAY is undefined) for a symbol whose
     name is the string SYMBOL-NAME. The value returned is the symbol
     if it can be found or false otherwise.

          (find-symbol "setq")
              => setq

 - Function: apropos regexp #!optional predicate obarray
     Returns a list of symbols from the obarray OBARRAY (or the
     default) whose print name matches the regular expression REGEXP
     (Note: Regular Expressions). If PREDICATE is true, each symbol
     which matches REGEXP is applied to the function PREDICATE, if the
     value is true it is considered a match.

     The PREDICATE argument is useful for restricting matches to a
     certain type of symbol, for example only commands.

          (apropos "^yank" 'commandp)
              => (yank-rectangle yank yank-to-mouse)


automatically generated by info2www version 1.2.2.9