Paste number 310079: macrolet-declare

Paste number 310079: macrolet-declare
Pasted by: stassats
When:1 year, 8 months ago
Share:Tweet this! | http://paste.lisp.org/+6N9B
Channel:None
Paste contents:
Raw Source | XML | Display As
(defun lookup-info (name env)
  (getf (macroexpand-1 '(declaration-macro) env) name))

(defmacro declaration-macro () nil)

(defmacro test-macro (name &environment env)
  `(+ 1 ,(lookup-info name env)))

(defmacro fancy-declare ((name value) &body body &environment env)
  `(macrolet ((declaration-macro ()
                '(,name ,value ,@(macroexpand-1 '(declaration-macro) env))))
     ,@body))

(defun test ()
  (fancy-declare (a 30)
    (fancy-declare (b 123)
      (list (test-macro b)
            (fancy-declare (b 10)
              (+ (test-macro b)
                 (test-macro a)))))))

This paste has no annotations.

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.