From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Yi DAI <plm.day@gmail.com> Newsgroups: gmane.lisp.guile.user Subject: A question on a piece of code written using call/cc Date: Wed, 1 Sep 2010 12:10:52 +0800 Message-ID: <AANLkTimtD1_hvLqS4tkrwXONuVBdtU=qAYJ12oGt1HrX@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=0016364c70ad65009c048f2ae3ca X-Trace: dough.gmane.org 1283314284 15282 80.91.229.12 (1 Sep 2010 04:11:24 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 1 Sep 2010 04:11:24 +0000 (UTC) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Wed Sep 01 06:11:23 2010 Return-path: <guile-user-bounces+guile-user=m.gmane.org@gnu.org> Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from <guile-user-bounces+guile-user=m.gmane.org@gnu.org>) id 1OqefR-00010A-74 for guile-user@m.gmane.org; Wed, 01 Sep 2010 06:11:21 +0200 Original-Received: from localhost ([127.0.0.1]:49639 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OqefQ-0004oa-Ej for guile-user@m.gmane.org; Wed, 01 Sep 2010 00:11:20 -0400 Original-Received: from [140.186.70.92] (port=36966 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OqefM-0004nW-88 for guile-user@gnu.org; Wed, 01 Sep 2010 00:11:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from <plm.day@gmail.com>) id 1OqefL-0007jj-5k for guile-user@gnu.org; Wed, 01 Sep 2010 00:11:16 -0400 Original-Received: from mail-wy0-f169.google.com ([74.125.82.169]:59565) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from <plm.day@gmail.com>) id 1OqefK-0007jX-Tt for guile-user@gnu.org; Wed, 01 Sep 2010 00:11:15 -0400 Original-Received: by wyb36 with SMTP id 36so10679823wyb.0 for <guile-user@gnu.org>; Tue, 31 Aug 2010 21:11:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:from:date :message-id:subject:to:content-type; bh=uaVSHzU0VCmgHWn6g9sfRq8qaiNg2owxZgE0EEgR6Jw=; b=SjPYHu52ZWE1xCtkmZZ+hSdie5OWIeK2TbZkceTZSzb0X+qrbXFCvI084r8XtEvXb3 +goJnETSv/Tc41ik8gbOdSqXfqD1a9QsdoJYH1o3hrzCGpNrlj77VK69izge5LNINt99 57OWdzDNGFTrrrmf51zC4JzMP5VfSRtMe6CEM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=aJDaYzw2CY1XjAPRlO29HF/LDv0N/zRmfjc1RFv3OOHHOQ5jw1zCvOYzCV4WkVe1D4 DRm292q3odkv0w6crxjoKOEnkfb8bgvc/gvWFZmQpP93VnE4eVfD7s6VbumfL9zOg3Yg XsXEeywFndht23MFi6qzQnxzIfsC+VejYckxM= Original-Received: by 10.227.129.71 with SMTP id n7mr1646471wbs.192.1283314273287; Tue, 31 Aug 2010 21:11:13 -0700 (PDT) Original-Received: by 10.216.68.21 with HTTP; Tue, 31 Aug 2010 21:10:52 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions <guile-user.gnu.org> List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/guile-user>, <mailto:guile-user-request@gnu.org?subject=unsubscribe> List-Archive: <http://lists.gnu.org/archive/html/guile-user> List-Post: <mailto:guile-user@gnu.org> List-Help: <mailto:guile-user-request@gnu.org?subject=help> List-Subscribe: <http://lists.gnu.org/mailman/listinfo/guile-user>, <mailto:guile-user-request@gnu.org?subject=subscribe> Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:8126 Archived-At: <http://permalink.gmane.org/gmane.lisp.guile.user/8126> --0016364c70ad65009c048f2ae3ca Content-Type: text/plain; charset=ISO-8859-1 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 --0016364c70ad65009c048f2ae3ca Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi,<div><br></div><div><br></div><div>I recently test a piece of code writt= en using call/cc on Guile and several other Scheme implementations, but get= different results. The code piece is as follows:</div><div><br></div><div> <font class=3D"Apple-style-span" face=3D"'courier new', monospace">= (let ((n 0)=A0</font></div><div><font class=3D"Apple-style-span" face=3D"&#= 39;courier new', monospace">=A0=A0 =A0 =A0(c (call/cc (lambda (k) k))))= </font></div> <div> <font class=3D"Apple-style-span" face=3D"'courier new', monospace">= =A0=A0(display n)</font></div><div><font class=3D"Apple-style-span" face=3D= "'courier new', monospace">=A0=A0(newline)</font></div><div><font c= lass=3D"Apple-style-span" face=3D"'courier new', monospace">=A0=A0(= set! n (+ n 1))</font></div> <div><font class=3D"Apple-style-span" face=3D"'courier new', monosp= ace">=A0=A0(c c))</font></div><div><br></div><div>What I wanna do is try to= print out the sequence of natural numbers using call/cc. On Guile, it work= s well. But other implementations (Chicken, Bigloo, Racket) all print out (= an infinite sequence of) 0. I am puzzled. Any idea?</div> <div><br></div><div><br>-- <br>DAY<br> </div> --0016364c70ad65009c048f2ae3ca--