From 47d04de6478f48c6296198776b0ed572e736b008 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 13 Nov 2013 17:14:09 -0800 Subject: DEFTAIL: a deftail function should know about itself; it is nonsensical to have to specify itself via :other-tails. Support for docstrings added too. --- tail-recursion.lisp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'tail-recursion.lisp') 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) -- cgit v1.2.3