From d4ade72f9e7c97217ffafb7f9ca37f12161148af Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20V=C3=A1zquez?= Date: Sat, 15 Jun 2013 18:28:57 +0200 Subject: [PATCH] Basic macrolet --- src/compiler.lisp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/compiler.lisp b/src/compiler.lisp index 071873d..2f20432 100644 --- a/src/compiler.lisp +++ b/src/compiler.lisp @@ -728,6 +728,19 @@ ",") ")"))) +(define-compilation macrolet (definitions &rest body) + (let ((*environment* (copy-lexenv *environment*))) + (dolist (def definitions) + (destructuring-bind (name lambda-list &body body) def + (let ((binding (make-binding :name name :type 'macro :value + (let ((g!form (gensym))) + `(lambda (,g!form) + (destructuring-bind ,lambda-list ,g!form + ,@body)))))) + (push-to-lexenv binding *environment* 'function)))) + (ls-compile `(progn ,@body) *multiple-value-p*))) + + (defun special-variable-p (x) (and (claimp x 'variable 'special) t)) -- 1.7.10.4