guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: stack overflow problem


From: Chusslove Illich
Subject: Re: stack overflow problem
Date: Sun, 5 Feb 2006 00:03:25 +0100
User-agent: KMail/1.8.3

> [: William Xu :]
> Might be a bug? (i also tested this on mzscheme, and works fine.)
>
> Guile version: 1.6.7, debian unstable.

Same Debian, same Guile, same effect. I guess stack has to go at one point 
or another, and it is anyway a better idea to use tail recursion:

(define (enumerate-interval low high)
  (letrec ((helper
             (lambda (low high seq)
                     (if (> low high)
                         seq
                         (helper low (1- high) (cons high seq))))))
    (helper low high '())))

-- 
Chusslove Illich (Часлав Илић)

Attachment: pgpQqE1K202_A.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]