summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--destructuring-bind.lisp25
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))