CL-USER> (defmacro with-auto-gensyms (&body body) (alexandria:with-gensyms (gensyms) `(let ((,gensyms (make-hash-table :test 'equalp))) (flet ((ensure-gensym (name) (alexandria:ensure-gethash (string name) ,gensyms (gensym (string name))))) ,@body)))) WITH-AUTO-GENSYMS CL-USER> (defun read-auto-gensym (stream char arg &optional (recursive-p nil)) (declare (ignore char arg)) (let ((v (read stream t nil recursive-p))) (check-type v (and symbol (not keyword)) "a non-keyword symbol") `,`(ensure-gensym ',v))) READ-AUTO-GENSYM CL-USER> (set-dispatch-macro-character #\# #\! 'read-auto-gensym) T CL-USER> (with-auto-gensyms `(let ((,#!foo 1)) ,#!foo)) (LET ((#:FOO620 1)) #:FOO620) CL-USER>