From: David Vázquez Date: Sat, 15 Jun 2013 16:28:57 +0000 (+0200) Subject: Basic macrolet X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=d4ade72f9e7c97217ffafb7f9ca37f12161148af;p=jscl.git Basic macrolet --- 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))