Advertisement
Guest User

Untitled

a guest
Sep 6th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 0.62 KB | None | 0 0
  1. (defmacro defalias-tmp (aliases &rest body )
  2.   (let (defs pre post)
  3.     (loop for (from to) in aliases
  4.           do
  5.           (if (fboundp from)
  6.               (let ((tmp (gensym "original-")))
  7.                 (push `(defalias ',tmp ',from) pre)
  8.                 (push `(defalias ',from ',tmp) post)
  9.                 (push `(fmakunbound ',tmp) post))
  10.             (push `(fmakunbound ',from) post))
  11.           collect `(defalias ',from ,to) into defs
  12.           finally
  13.           (return
  14.            `(progn
  15.               ,@pre
  16.               ,@defs
  17.               (prog1 (progn ,@body)
  18.                 ,@(reverse post)))))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement