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


Symbols

Guile symbol tables are hash tables. Each hash table, also called an obarray (for `object array'), is a vector of association lists. Each entry in the alists is a pair (SYMBOL . VALUE). To intern a symbol in a symbol table means to return its (SYMBOL . VALUE) pair, adding a new entry to the symbol table (with an undefined value) if none is yet present.

primitive: string->obarray-symbol obarray string [soft?]
Intern a new symbol in obarray, a symbol table, with name string.

If obarray is #f, use the default system symbol table. If obarray is #t, the symbol should not be interned in any symbol table; merely return the pair (symbol . #<undefined>).

The soft? argument determines whether new symbol table entries should be created when the specified symbol is not already present in obarray. If soft? is specified and is a true value, then new entries should not be added for symbols not already present in the table; instead, simply return #f.

primitive: intern-symbol obarray string
Add a new symbol to obarray with name string, bound to an unspecified initial value. The symbol table is not modified if a symbol with this name is already present.

primitive: unintern-symbol obarray string
Remove the symbol with name string from obarray. This function returns #t if the symbol was present and #f otherwise.

primitive: symbol-binding obarray string
Look up in obarray the symbol whose name is string, and return the value to which it is bound. If obarray is #f, use the global symbol table. If string is not interned in obarray, an error is signalled.

primitive: symbol-interned? obarray string
Return #t if obarray contains a symbol with name string, and #f otherwise.

primitive: symbol-bound? obarray string
Return #t if obarray contains a symbol with name string bound to a defined value. This differs from symbol-bound? in that the mere mention of a symbol usually causes it to be interned; symbol-bound? determines whether a symbol has been given any meaningful value.

primitive: symbol-set! obarray string value
Find the symbol in obarray whose name is string, and rebind it to value. An error is signalled if string is not present in obarray.

primitive: symbol-fref symbol
Return the contents of symbol's function slot.

primitive: symbol-pref symbol
Return the property list currently associated with symbol.

primitive: symbol-fset! symbol
Change the binding of symbol's function slot.

primitive: symbol-pset! symbol
Change the binding of symbol's property slot.

primitive: symbol-hash symbol
Return the hash value derived from symbol's name, i.e. the integer index into symbol's obarray at which it is stored.

primitive: builtin-bindings
Create and return a copy of the global symbol table, removing all unbound symbols.

primitive: builtin-weak-bindings

primitive: gensym [name [obarray]]
Create a new, unique symbol in obarray, using the global symbol table by default. If name is specified, it should be used as a prefix for the new symbol's name. The default prefix is %%gensym.


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