summaryrefslogtreecommitdiffstats
path: root/txr.1
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2014-02-17 20:35:18 -0800
committerKaz Kylheku <kaz@kylheku.com>2014-02-17 20:35:18 -0800
commit40cf26fa17e090f342e44d4008013e65f0e81190 (patch)
treec78b38908f0ec928bd77fcacb1a24a8d77b564e1 /txr.1
parentf1bcb15c4979b9af3823223854fe16bfe155b2fe (diff)
downloadtxr-40cf26fa17e090f342e44d4008013e65f0e81190.tar.gz
txr-40cf26fa17e090f342e44d4008013e65f0e81190.tar.bz2
txr-40cf26fa17e090f342e44d4008013e65f0e81190.zip
* eval.c (eval_init): Register gensym function as the gensym
intrinsic, rather than gensymv. Register gensym_counter as *gensym-counter*. * lib.c (gensym): Handle missing prefix argument by defaulting the prefix to "g". (gensymv): Function removed. * lib.h (gensymv): Declaration removed. * txr.1: Fixed omission: missing documentation for gensym. Documented *gensym-counter*.
Diffstat (limited to 'txr.1')
-rw-r--r--txr.129
1 files changed, 29 insertions, 0 deletions
diff --git a/txr.1 b/txr.1
index 2ccb8338..fb40e7f1 100644
--- a/txr.1
+++ b/txr.1
@@ -11734,6 +11734,35 @@ does not belong to any package (it is said to be "uninterned").
Note: an uninterned symbol can be interned into a package with the rehome-sym
function. Also see the intern function.
+.SS Function gensym
+
+.TP
+Syntax:
+
+ (gensym [<prefix>])
+
+Description
+
+The gensym function is similar to make-sym. It creates and returns a new
+symbol object. If the <prefix> argument is omitted, it defaults to "g".
+Otherwise it must be a string.
+
+The difference between gensym and make-sym is that gensym creates the name
+by combining the prefix with a numeric suffix.
+
+The numeric sufix is a decimal digit string, taken from the value of
+the variable *gensym-counter*, after incrementing it.
+
+Note: the variation in name is not the basis of the uniqueness of gensym; the
+basis of its uniqueness is that it is a freshly instantiated object. make-sym
+also returns unique symbols even if repeatedly called with the same string.
+
+.SS Variable *gensym-counter*
+
+This variable is initialized to 0. Each time the gensym function is called,
+it is incremented. The incremented value forms the basis of the numeric
+suffix which gensym uses to form the name of the new symbol.
+
.SS Function make-package
.TP