From 95108b1375281d198995c902c700a66b7bc9c6a3 Mon Sep 17 00:00:00 2001 From: David Vazquez Date: Sun, 16 Dec 2012 00:02:49 +0000 Subject: [PATCH] Define defmacro --- test.lisp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test.lisp b/test.lisp index 54d4a63..86848e0 100644 --- a/test.lisp +++ b/test.lisp @@ -34,3 +34,17 @@ (setq x 0) (incf x) (debug x) + +(eval-when-compile + (%compile-defmacro 'defmacro + (lambda (name args &rest body) + (list 'eval-when-compile + (list '%compile-defmacro (list 'quote name) + (list* 'lambda args body)))))) + +(defmacro %incf (x) + (list 'setq x (list '+ 1 x))) + +(setq x 10) +(%incf x) +(debug x) -- 1.7.10.4