Copyright (C) 2000-2012 |
GNU Info (cl)Creating SymbolsCreating Symbols ================ These functions create unique symbols, typically for use as temporary variables. - Function: gensym &optional x This function creates a new, uninterned symbol (using `make-symbol') with a unique name. (The name of an uninterned symbol is relevant only if the symbol is printed.) By default, the name is generated from an increasing sequence of numbers, `G1000', `G1001', `G1002', etc. If the optional argument X is a string, that string is used as a prefix instead of `G'. Uninterned symbols are used in macro expansions for temporary variables, to ensure that their names will not conflict with "real" variables in the user's code. - Variable: *gensym-counter* This variable holds the counter used to generate `gensym' names. It is incremented after each use by `gensym'. In Common Lisp this is initialized with 0, but this package initializes it with a random (time-dependent) value to avoid trouble when two files that each used `gensym' in their compilation are loaded together. (Uninterned symbols become interned when the compiler writes them out to a file and the Emacs loader loads them, so their names have to be treated a bit more carefully than in Common Lisp where uninterned symbols remain uninterned after loading.) - Function: gentemp &optional x This function is like `gensym', except that it produces a new _interned_ symbol. If the symbol that is generated already exists, the function keeps incrementing the counter and trying again until a new symbol is generated. The Quiroz `cl.el' package also defined a `defkeyword' form for creating self-quoting keyword symbols. This package automatically creates all keywords that are called for by `&key' argument specifiers, and discourages the use of keywords as data unrelated to keyword arguments, so the `defkeyword' form has been discontinued. automatically generated by info2www version 1.2.2.9 |