+(defun gensym (&optional arg)
+ "Generate a new uninterned symbol.
+The name is made by appending a number to a prefix. If ARG is a string, it
+is the prefix, otherwise the prefix defaults to \"G\". If ARG is an integer,
+the internal counter is reset to that number before creating the name.
+There is no way to specify both using this function."
+ (let ((prefix (if (stringp arg) arg "G"))
+ (num (if (integerp arg) arg
+ (prog1 *gensym-counter*
+ (setq *gensym-counter* (1+ *gensym-counter*))))))
+ (make-symbol (format "%s%d" prefix num))))
+
+(defun gentemp (&optional arg)
+ "Generate a new interned symbol with a unique name.
+The name is made by appending a number to ARG, default \"G\".
+If ARG is not a string, it is ignored."
+ (let ((prefix (if (stringp arg) arg "G"))
+ name)
+ (while (intern-soft (setq name (format "%s%d" prefix *gensym-counter*)))
+ (setq *gensym-counter* (1+ *gensym-counter*)))
+ (intern name)))