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): (define y (integral (delay dy) 1 0.001)) (define dy (stream-map (lambda (x) x) y)) (stream-ref y 1000) The following code *should* be identical: (define (solve f y0 dt) (define y (integral (delay dy) y0 dt)) (define dy (stream-map f y)) y) (solve (lambda (x) x) 1 0.001) But it yields the error message: standard input:7:14: While evaluating arguments to stream-map in expression (stream-map f y): standard input:7:14: Unbound variable: y ABORT: (unbound-variable) So when embedded in a procedure definition, the (define y ...) does not work, whereas outside the procedure it works fine. What am I doing wrong here? I can post the auxiliary code (i.e., the definitions of integral, stream-map etc.) if necessary, too. -- View this message in context: http://old.nabble.com/Strange-behavior-with-delayed-objects-tp28443452p28443452.html Sent from the Gnu - Guile - User mailing list archive at Nabble.com.