diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2014-08-10 08:25:27 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2014-08-10 10:19:02 -0700 |
commit | c520864724c3836301b5a1fd835dda325cc58ba3 (patch) | |
tree | 24b643a269e8e06c151bfaf2265c346692523a37 | |
parent | 46ea0f5f027c8a2cdfec65d2952010d99848174e (diff) | |
download | lisp-snippets-c520864724c3836301b5a1fd835dda325cc58ba3.tar.gz lisp-snippets-c520864724c3836301b5a1fd835dda325cc58ba3.tar.bz2 lisp-snippets-c520864724c3836301b5a1fd835dda325cc58ba3.zip |
DEFTAIL: Trivial code improvement.
-rw-r--r-- | tail-recursion.lisp | 7 |
1 files 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) |