[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Strange behavior with delayed objects
From: |
user8472 |
Subject: |
Re: Strange behavior with delayed objects |
Date: |
Fri, 14 May 2010 14:53:27 -0700 (PDT) |
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.
<code>
(define (solve f y0 dt)
(define (y) (integral (delay (dy)) y0 dt))
(define (dy) (stream-map f (y)))
(y))
(debug-set! stack 2000000)
(stream-ref (solve (lambda (x) x) 1 0.001) 1000)
</code>
will produce the correct answer. The downside is that the function calls
will be wrapped recursively which necessitates increasing the stack size.
Plus, it's much slower this way. But it works.
--
View this message in context:
http://old.nabble.com/Strange-behavior-with-delayed-objects-tp28443452p28564620.html
Sent from the Gnu - Guile - User mailing list archive at Nabble.com.
- Strange behavior with delayed objects, user8472, 2010/05/04
- Re: Strange behavior with delayed objects, Linas Vepstas, 2010/05/04
- Re: Strange behavior with delayed objects, user8472, 2010/05/04
- Re: Strange behavior with delayed objects, Linas Vepstas, 2010/05/05
- Re: Strange behavior with delayed objects, user8472, 2010/05/07
- Re: Strange behavior with delayed objects, Linas Vepstas, 2010/05/10
- Re: Strange behavior with delayed objects, Linas Vepstas, 2010/05/10
- Re: Strange behavior with delayed objects, user8472, 2010/05/10
- Re: Strange behavior with delayed objects, Linas Vepstas, 2010/05/10
Re: Strange behavior with delayed objects, Andy Wingo, 2010/05/21
Re: Strange behavior with delayed objects,
user8472 <=