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.

gensym

gensym

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

SYNTAX

(gensym [<tag>])
        <tag>           -       an optional integer or string 

DESCRIPTION

GENSYM generates and returns a symbol.

The default symbol form is as a character G followed by a number - Gn. The default numbering starts at 1. You can change what the generated symbol looks like. By calling GENSYM with a string <tag>, the default string is set to string parameter. If an integer number is the <tag>, the current number is set to the integer parameter.

EXAMPLES

(gensym)                                ; first time => G1
(gensym 100)                            ; returns G100
(gensym "MYGENSYM")                     ; returns MYGENSYM101
(gensym 0)                              ; returns MYGENSYM0
(gensym)                                ; returns MYGENSYM1
(gensym "G")                            ; \
(gensym 0)                              ; /  put it back to 'normal'
(gensym)                                ; just like first time => G1

NOTE: It takes 2 calls to GENSYM to set both portions of the GENSYM symbol.

NOTE: Although it is possible to call GENSYM with numbers in the string (like "AB1"), this does generate an odd sequence. What will happen is you will get a sequence of symbols like .....AB18 AB19 AB110 AB111.....


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