guile-user
[Top][All Lists]
Advanced

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

Re: Strange behavior with delayed objects


From: Andy Wingo
Subject: Re: Strange behavior with delayed objects
Date: Fri, 21 May 2010 12:52:50 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (gnu/linux)

Hello,

On Tue 04 May 2010 17:21, Linas Vepstas <address@hidden> writes:

> On 4 May 2010 01:32, user8472 <address@hidden> wrote:
>>
>> 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)
>
> You should use let*, not define, for this.

Incidentally, R6RS would expand out these internal defintions using
letrec*, which would be equivalent to let* in this case.

Andy
-- 
http://wingolog.org/



reply via email to

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