diff options
author | Matthias Andreas Benkard <matthias@benkard.de> | 2008-07-27 12:49:25 +0200 |
---|---|---|
committer | Matthias Andreas Benkard <matthias@benkard.de> | 2008-07-27 12:49:25 +0200 |
commit | 0d4f4b4b80adf7ee4fe407ebb8f85e6f0bff64f3 (patch) | |
tree | 39fe040baefc1865f4c345070236499e6b984d8c | |
parent | d2370aa9d420b1e466e58f00dbda0309ade6ced9 (diff) |
Add DEFMACRO, DEFUN, and DESTRUCTURING-BIND.
-rw-r--r-- | destructuring-bind.lisp | 25 |
1 files changed, 24 insertions, 1 deletions
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)) |