[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: |
Mon, 10 May 2010 14:36:33 -0700 (PDT) |
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 suggestion. I also checked Guile 1.8.6 on OpenSUSE Linux.
On all of these systems the code you have posted always returns an error
"Unbound variable: dy".
To my understanding in your construction "dy" is defined in an environment
INSIDE the environment where "y" is defined. This *should* result in "dy"
being undefined when you refer to it in the definition of "y". As far as I
can see "y" and "dy" *must* be defined in the same environment, otherwise
the circular reference cannot work.
Is it possible that you first typed the (define y ...) and (define dy ...)
things at the REPL (thereby defining them in the global environment)? In
that case, the procedures you have defined would not work, but the
definition of "y" would simply refer to the definition of "dy" in the global
environment, thereby masking the true problem.
Linas Vepstas-3 wrote:
>
> Well, you modified your code enough so that let* now works fine,
> at least for me:
> [...]
> guile> (stream-ref (solve (lambda (x) x) 1 0.001) 1000)
> 2.7169239322359
>
> Superficially, I want to say "this is why let* was invented, to
> ensure ordering of definitions". In practice, I see that dy is
> used in both, so there's a circular reference going on here.
>
--
View this message in context:
http://old.nabble.com/Strange-behavior-with-delayed-objects-tp28443452p28517284.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 <=
- 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, 2010/05/14