unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: William Xu <william.xwl@gmail.com>
Subject: Re: stack overflow problem
Date: Sun, 05 Feb 2006 22:08:04 +0800	[thread overview]
Message-ID: <87fymxlwzf.fsf@www.williamxu.com> (raw)
In-Reply-To: <1139102293.923.16.camel@nocandy.dyndns.org> (Stephen Compall's message of "Sat, 04 Feb 2006 19:18:13 -0600")

Stephen Compall <s11@member.fsf.org> writes:

> On Sat, 2006-02-04 at 18:54 +0800, William Xu wrote:
>> (define (enumerate-interval low high)
>>   "Return a sequence list by walking from LOW to HIGH.
>> e.g.,
>>         (enumerate-interval 1 10)
>>                                  => (1 2 3 4 5 6 7 8 9 10)"
>>   (if (> low high)
>>       '()
>>       (cons low (enumerate-interval (1+ low) high))))
>> 
>> When i passed it a slightly big interval, guile complains "stack
>> overflow", 
>> 
>> 
>> Might be a bug? (i also tested this on mzscheme, and works fine.)
>
> Sorry, but while optimization of tail calls is guaranteed by R5RS,
> non-tail recursion to arbitrary depth is not.  Try rewriting your code
> so that the recursive call is the "last thing" done; 

Yeah, i understand that. But i thought this ought to be done
automatically in some way, not requiring user to do this manually, which
would make codes less readable, isn't it?

[...]

-- 
William


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


  reply	other threads:[~2006-02-05 14:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-04 10:54 stack overflow problem William Xu
2006-02-04 23:03 ` Chusslove Illich
2006-02-05  1:18 ` Stephen Compall
2006-02-05 14:08   ` William Xu [this message]
2006-02-13 18:08     ` Holger Blasum
  -- strict thread matches above, loose matches on Subject: below --
2006-02-04 17:09 William Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fymxlwzf.fsf@www.williamxu.com \
    --to=william.xwl@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).