This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: Recursive vs. tail-recursive functions
- To: Andrew Ho <andrew at tellme dot com>
- Subject: Re: Recursive vs. tail-recursive functions
- From: William Webber <william at ferengi dot live dot com dot au>
- Date: Thu, 8 Jun 2000 16:38:46 +1000
- Cc: Guile Mailing List <guile at sourceware dot cygnus dot com>
- References: <Pine.BSF.4.21.0006072258390.69964-100000@never.tellme.com>
On Wed, Jun 07, 2000 at 11:18:05PM -0700, Andrew Ho wrote:
> The strange result seems to be that the simple recursive case is
> significantly faster than the tail-recursive case.
Especially when the simple recursive case runs out of stack. :-)
I'd be interested to know why this is, too, but the reason for
re-writing these list operations tail-recursively is to avoid
overflowing the stack, not for performance. (I discovered that
they weren't tail-recursive not by a thorough examination of the
source, nor because my program seemed suspiciously slow, but
because by program finished inappropriately quickly.)
Regards,
William