comparison lisp/cl-macs.el @ 404:2f8bb876ab1d r21-2-32

Import from CVS: tag r21-2-32
author cvs
date Mon, 13 Aug 2007 11:16:07 +0200
parents 74fd4e045ea6
children de805c49cfc1
comparison
equal deleted inserted replaced
403:9f011ab08d48 404:2f8bb876ab1d
102 (if (eq (car-safe form) 'progn) 102 (if (eq (car-safe form) 'progn)
103 (cons 'progn (mapcar 'byte-compile-file-form (cdr form))) 103 (cons 'progn (mapcar 'byte-compile-file-form (cdr form)))
104 (funcall cl-old-bc-file-form form))))) 104 (funcall cl-old-bc-file-form form)))))
105 (put 'eql 'byte-compile 'cl-byte-compile-compiler-macro) 105 (put 'eql 'byte-compile 'cl-byte-compile-compiler-macro)
106 (run-hooks 'cl-hack-bytecomp-hook)) 106 (run-hooks 'cl-hack-bytecomp-hook))
107
108
109 ;;; Symbols.
110
111 (defvar *gensym-counter*)
112
113 ;;;###autoload
114 (defun gensym (&optional arg)
115 "Generate a new uninterned symbol.
116 The name is made by appending a number to PREFIX, default \"G\"."
117 (let ((prefix (if (stringp arg) arg "G"))
118 (num (if (integerp arg) arg
119 (prog1 *gensym-counter*
120 (setq *gensym-counter* (1+ *gensym-counter*))))))
121 (make-symbol (format "%s%d" prefix num))))
122
123 ;;;###autoload
124 (defun gentemp (&optional arg)
125 "Generate a new interned symbol with a unique name.
126 The name is made by appending a number to PREFIX, default \"G\"."
127 (let ((prefix (if (stringp arg) arg "G"))
128 name)
129 (while (intern-soft (setq name (format "%s%d" prefix *gensym-counter*)))
130 (setq *gensym-counter* (1+ *gensym-counter*)))
131 (intern name)))
132 107
133 108
134 ;;; Program structure. 109 ;;; Program structure.
135 110
136 ;;;###autoload 111 ;;;###autoload