diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2013-11-13 17:14:09 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2013-11-13 17:15:33 -0800 |
commit | 47d04de6478f48c6296198776b0ed572e736b008 (patch) | |
tree | 5502f292d0352065749f731a01f000869ce84d41 | |
parent | 475a069b91a5a4740f66c22ad7f048a798d3bb63 (diff) | |
download | lisp-snippets-47d04de6478f48c6296198776b0ed572e736b008.tar.gz lisp-snippets-47d04de6478f48c6296198776b0ed572e736b008.tar.bz2 lisp-snippets-47d04de6478f48c6296198776b0ed572e736b008.zip |
DEFTAIL: a deftail function should know about itself; it is nonsensical
to have to specify itself via :other-tails.
Support for docstrings added too.
-rw-r--r-- | tail-recursion.lisp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tail-recursion.lisp b/tail-recursion.lisp index 7940113..635982e 100644 --- a/tail-recursion.lisp +++ b/tail-recursion.lisp @@ -251,8 +251,12 @@ (defmacro deftail (name lambda-list &body body) (let ((escape (gensym "ESCAPE-")) - (other-tails) + (other-tails `(,name)) + (docstring) (decls)) + (when (stringp (first body)) + (setf docstring (list (first body))) + (pop body)) (loop for f = (first body) while (and (consp f) (case (first f) @@ -261,6 +265,7 @@ (declare (setf decls (append decls (rest f))) t))) do (pop body)) `(defun ,name (,@lambda-list &aux (,escape *tail-escape*)) + ,@docstring ,@decls (flet (,@(loop for other in other-tails collecting `(,other (&rest args) |