unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Yi DAI <plm.day@gmail.com>
To: guile-user@gnu.org
Subject: A question on a piece of code written using call/cc
Date: Wed, 1 Sep 2010 12:10:52 +0800	[thread overview]
Message-ID: <AANLkTimtD1_hvLqS4tkrwXONuVBdtU=qAYJ12oGt1HrX@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 509 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 1167 bytes --]

             reply	other threads:[~2010-09-01  4:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-01  4:10 Yi DAI [this message]
2010-09-01 15:35 ` A question on a piece of code written using call/cc Andy Wingo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AANLkTimtD1_hvLqS4tkrwXONuVBdtU=qAYJ12oGt1HrX@mail.gmail.com' \
    --to=plm.day@gmail.com \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).