Hans Aberg <[email protected]> writes:
> In the code below the 'loop' and 'begin' examples will execute the
> while' loop, but if put into the body of a function, 'while' will not
> run. So why, and how to fix it?
>
> Just copy and paste the examples below into guile. For the two first,
> I get
> 0123456789
> 0123456789done!3
> but for the third, the thunk, only
> done!3
With my current Guile,
scheme@(guile-user)> (version)
$4 = "1.9.14.17-44f43"
the third case behaves as you would expect:
scheme@(guile-user)> ((lambda
()
(begin
(loop ((define i 0))
(< i 10)
((set! i (+ i 1)))
((display i)))
(display "done!")
(+ 1 2)
)
))
0123456789done!$5 = 3
Regards,
Neil