From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo <wingo@pobox.com> Newsgroups: gmane.lisp.guile.user Subject: Re: A question on a piece of code written using call/cc Date: Wed, 01 Sep 2010 08:35:48 -0700 Message-ID: <m3bp8hv5m3.fsf@unquote.localdomain> References: <AANLkTimtD1_hvLqS4tkrwXONuVBdtU=qAYJ12oGt1HrX@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1283355170 12892 80.91.229.12 (1 Sep 2010 15:32:50 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 1 Sep 2010 15:32:50 +0000 (UTC) Cc: guile-user@gnu.org To: Yi DAI <plm.day@gmail.com> Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Wed Sep 01 17:32:48 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 1OqpIt-0004ln-Tb for guile-user@m.gmane.org; Wed, 01 Sep 2010 17:32:48 +0200 Original-Received: from localhost ([127.0.0.1]:57966 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OqpIt-0005En-5a for guile-user@m.gmane.org; Wed, 01 Sep 2010 11:32:47 -0400 Original-Received: from [140.186.70.92] (port=56102 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OqpIk-0005Ea-N9 for guile-user@gnu.org; Wed, 01 Sep 2010 11:32:39 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from <wingo@pobox.com>) id 1OqpIj-00074X-8B for guile-user@gnu.org; Wed, 01 Sep 2010 11:32:38 -0400 Original-Received: from a-pb-sasl-quonix.pobox.com ([208.72.237.25]:41875 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from <wingo@pobox.com>) id 1OqpIj-00074R-5F for guile-user@gnu.org; Wed, 01 Sep 2010 11:32:37 -0400 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 7F555D2118; Wed, 1 Sep 2010 11:32:36 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; s=sasl; bh=O0oA7oTX9u7A 4mpPgcoH7agL/do=; b=pE4BbZvA7rT4oS2QX70lxyGN6cRZk8u2sgexAO4njSdI 9CfbPQc1HYhowY+SWqIw0CcBVx7BGMUTJN6u8awZ8lxuQC34z0+AHbN5fIzvB91L nuOzm1BmYqixkGJ6Kps4YYSuX6xDRrWpW5Dgb8fcDfNYCkN8uir1Rtwg9krmC0I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; q=dns; s=sasl; b=FEJxgT 2Wbc5ig7jQJt+E7BTvqzs1qOdXt7gk/98B1AO87QnizWkUCTnucQ+Amlsu0Q8GGd rIFuP9IaZIf0/XZNiV/zRp2MOnJmFYnGpq139GSIKhjUy7XnzjEVqsvvQ+UiNz0K i+OYMyx4AaEyTSpDv2IBG9p8oO/XUtV87mDmQ= Original-Received: from a-pb-sasl-quonix. (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 6C89FD2116; Wed, 1 Sep 2010 11:32:35 -0400 (EDT) Original-Received: from unquote.localdomain (unknown [75.28.21.123]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTPSA id E325BD2115; Wed, 1 Sep 2010 11:32:33 -0400 (EDT) In-Reply-To: <AANLkTimtD1_hvLqS4tkrwXONuVBdtU=qAYJ12oGt1HrX@mail.gmail.com> (Yi DAI's message of "Wed, 1 Sep 2010 12:10:52 +0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) X-Pobox-Relay-ID: 25186966-B5DE-11DF-82BA-030CEE7EF46B-02397024!a-pb-sasl-quonix.pobox.com X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) 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:8134 Archived-At: <http://permalink.gmane.org/gmane.lisp.guile.user/8134> Hi Yi, On Tue 31 Aug 2010 21:10, Yi DAI <plm.day@gmail.com> writes: > (let ((n 0)=C2=A0 > =C2=A0=C2=A0 =C2=A0 =C2=A0(c (call/cc (lambda (k) k)))) > =C2=A0=C2=A0(display n) > =C2=A0=C2=A0(newline) > =C2=A0=C2=A0(set! n (+ n 1)) > =C2=A0=C2=A0(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 --=20 http://wingolog.org/