From 0d4f4b4b80adf7ee4fe407ebb8f85e6f0bff64f3 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Sun, 27 Jul 2008 12:49:25 +0200 Subject: Add DEFMACRO, DEFUN, and DESTRUCTURING-BIND. --- destructuring-bind.lisp | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/destructuring-bind.lisp b/destructuring-bind.lisp index 7be7e41..021076d 100644 --- a/destructuring-bind.lisp +++ b/destructuring-bind.lisp @@ -108,7 +108,30 @@ (t `(let ((,lambda-list ,expression)) ,@body))))) +(%defmacro* destructuring-bind (tree expression . body) + `(d-b ,tree nil nil ,expression ,@body)) + + +(%defmacro* defun (name lambda-list . body) + (let ((lambda-sym (gensym))) + `(%defun ,name ,lambda-sym + (d-b ,lambda-list nil nil ,lambda-sym + ,@body)))) + +(%defmacro* defmacro (name lambda-list . body) + (let ((arg-sym (gensym)) + (lambda-sym (gensym)) + (whole-sym (gensym)) + (env-sym (gensym))) + `(%defmacro ,name ,arg-sym + (let ((,whole-sym (first ,arg-sym)) + (,lambda-sym (cdr (first ,arg-sym))) + (,env-sym (second ,arg-sym))) + (d-b ,lambda-list ,env-sym ,whole-sym ,lambda-sym + ,@body))))) + (export '(destructuring-bind lambda-list-keywords &allow-other-keys &aux &body &environment &key &optional &rest - &whole)) + &whole + defmacro defun)) -- cgit v1.2.3