OK, I have found a solution. The point is that in section 4.2.2 of R5RS it is
explicitly stated that mutually recursive defines must not refer to those
variables. The solution is thus to wrap the defines in (lambda () ...)s.
(define (solve f y0 dt)
(define (y) (integral (delay (dy)) y0 dt))
Thanks for your response. I have tried both of your suggestions and they
don't work on Guile 1.4 and Guile 1.8.6. I have installed them using Fink on
MacOS X 10.6, all latest patches installed. Guile 1.8.7 is not yet
distributed with Fink, so I used Ubuntu Linux 10.4 with Guile 1.8.7 to test
your
ream-ref (solve (lambda (x) x) 1 0.001) 1000)
Linas Vepstas-3 wrote:
>
> On 4 May 2010 11:59, user8472 wrote:
> [...]
>> streams.scm:601:14: While evaluating arguments to stream-map in
>> expression
>> (stream-map f y):
>> streams.scm:601:14: Variable used bef
Thanks for your reply. Yes, SICP introduces "let*" in chapter 4.1. The
current exercise is in chapter 3.5, though ;^)
Your suggestion is definitely a step in the right direction. However, it
does not yet solve the problem. The code
(define (solve f y0 dt)
(let* ((y (integral (delay dy) y0 d
I am currently working through SICP using Guile. I have found some strange
behavior when doing the exercises in chapter 3.5. I am running Guile 1.4
installed via Fink on Mac OS X 10.6, all latest patches installed. The
problem also exists in Guile 1.8.6.
This code works fine (and computes e):
(