Re: Multivalue tail recursion?
- From: Tim Bradshaw <tfb+google@xxxxxxxx>
- Date: Thu, 06 Sep 2007 10:35:20 -0700
So my question is this: does this count as tail recursion? The actual
"last operation" of the function is just repackaging the values
returned from the recursive call. Can lisp's compiler optimize this
into a loop?
Common Lisp does not promise tail call elimination of any kind, so
whether this gets optimised is entirely dependent on the
implementation. If you need it to be a loop on any implementation,
you should write it as one (indeed the LOOP macro is the absolute king
of clarity for doing something like this.
And, secondarily, is it considered naughty to use variables like
"list" and "rest" that are built-in function names?
No. Indeed since it causes Lisp-1 people to go red in the face it is
considered particularly good style. If you can cause them actually to
burst Kenny will send you a reward.
--tim
.
- References:
- Multivalue tail recursion?
- From: Erik R.
- Multivalue tail recursion?
- Prev by Date: Re: Multivalue tail recursion?
- Next by Date: Re: AllegroCL 8.1
- Previous by thread: Re: Multivalue tail recursion?
- Next by thread: Re: Multivalue tail recursion?
- Index(es):
Relevant Pages
|