From c520864724c3836301b5a1fd835dda325cc58ba3 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sun, 10 Aug 2014 08:25:27 -0700 Subject: DEFTAIL: Trivial code improvement. --- tail-recursion.lisp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tail-recursion.lisp b/tail-recursion.lisp index cca24a7..40e94c9 100644 --- a/tail-recursion.lisp +++ b/tail-recursion.lisp @@ -204,6 +204,10 @@ ;;; bailing out dynamically to a dispatching loop which calls the next ;;; function in the chain. ;;; +;;; NOTE: The Wikipedia describes a trampoline based approach for tail +;;; recursion, which is probably more or less equivalent to what is going on +;;; here. The *tail-escape* can be identified as the trampoline function. +;;; ;;; It would be inconvenient to have to use TAIL-CALL everywhere in a tail ;;; block. We can hide the tail call mechanism behind lexical functions, so ;;; that a tail block can use ordinary function call syntax to call its @@ -254,8 +258,7 @@ (docstring) (decls)) (when (stringp (first body)) - (setf docstring (list (first body))) - (pop body)) + (setf docstring (list (pop body)))) (loop for f = (first body) while (and (consp f) (case (first f) -- cgit v1.2.3