[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: A question on a piece of code written using call/cc
From: |
Andy Wingo |
Subject: |
Re: A question on a piece of code written using call/cc |
Date: |
Wed, 01 Sep 2010 08:35:48 -0700 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) |
Hi Yi,
On Tue 31 Aug 2010 21:10, Yi DAI <address@hidden> writes:
> (let ((n 0)
> (c (call/cc (lambda (k) k))))
> (display n)
> (newline)
> (set! n (+ n 1))
> (c c))
>
> What I wanna do is try to print out the sequence of natural numbers
> using call/cc. On Guile, it works well. But other implementations
> (Chicken, Bigloo, Racket) all print out (an infinite sequence of) 0. I
> am puzzled. Any idea?
Guile from master returns a sequence of zeros as well. I'm not sure why
older Guile behaves differently.
I think in any case for your program to be correct, you need to use let*
instead of let.
Andy
--
http://wingolog.org/