All pastes #497916 Raw Edit

Something

public text v1 · immutable
·published 2007-05-20 03:39 UTC
rendered paste body
(defmacro eval-once ((&rest names) &body body)
  (let ((orig (mapcar (λ (x) (gensym (strcat "orig-" (symbol-name x) "-")))
                       names))
        (evaled (mapcar (λ (x) `',(gensym (strcat "evaled-" (symbol-name x) "-")))
                         names)))
    `(let ,(mapcar #'list orig names)
       (let ,(mapcar #'list names evaled)
         `(let ,(mapcar #'list (list ,@evaled) (list ,@orig))
            ,,@body)))))