Advertisement
Guest User

Untitled

a guest
Oct 9th, 2018
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 0.52 KB | None | 0 0
  1. (defmacro my-macro (name)
  2.   `(,name :initarg ,name
  3.           :accessor ,(intern
  4.                       (format nil "MY-CLASS-~A" (symbol-name name)))))
  5.  
  6.  ;; => (MY-SLOT :INITARG MY-SLOT :ACCESSOR MY-CLASS-MY-SLOT), T
  7. (macroexpand '(my-macro my-slot))
  8.  
  9. ;; => (SLOT MY-SLOT), NIL
  10. (macrolet ((slot (name)
  11.              `(,name :initarg ,name
  12.                      :accessor ,(intern
  13.                                  (format nil "MY-CLASS-~A" (symbol-name name)))
  14.                      )))
  15.   (macroexpand '(slot my-slot)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement