std-gensym


Synopsis

(std-gensym)

Description

Create a new unbound symbol. Subsequent calls will create new unbound symbols. The name of the symbol will be "G" plus the string representation of the number *GENSYM-COUNTER*. The initial value of *GENSYM-COUNTER* is 0, the first call of (std-gensym) will return the symbol G0, subsequent calls G1, G2 and so on.

This function may be useful to create dynamically temporary anonymous symbols or functions.

It is not explicitly forbidden to set *GENSYM-COUNTER*, but it must be a integer value then.

Note

This behaviour changed after version 0.3013. Before it didn't create fresh symbols which made CL-like coding complicated.

AutoLISP has a completely broken behaviour of the BOUND predicate. In AutoLISP bound is the same as (not (null)), in normal lisp it tells if the symbol exists regardless if it's nil or not. In Lisp a symbol may be both: bound and nil, in AutoLISP this isimpossible.

Example

(setq x (std-gensym)) => G0
(eval x)		   => nil
(std-gensym) => G1

(set (std-gensym) 1) => 1 ;side-effect: creates G2

(eval x)		   => nil

Arguments

None

Return Value

A new symbol.

Side Effects

Increments *GENSYM-COUNTER* by one.

Module

(std-require 'STDLISP)

Defined in STDLISP.