guile-user
[Top][All Lists]
Advanced

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

A question on a piece of code written using call/cc


From: Yi DAI
Subject: A question on a piece of code written using call/cc
Date: Wed, 1 Sep 2010 12:10:52 +0800

Hi,


I recently test a piece of code written using call/cc on Guile and several other Scheme implementations, but get different results. The code piece is as follows:

(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?


--
DAY

reply via email to

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