From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alexander Asteroth Newsgroups: gmane.lisp.guile.user Subject: letrec semantics Date: Mon, 28 Nov 2022 09:33:54 +0100 Message-ID: <87sfi379eb.fsf@soeven.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20768"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.8.11; emacs 28.2 To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Mon Nov 28 09:48:30 2022 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ozZoT-0005AA-6f for guile-user@m.gmane-mx.org; Mon, 28 Nov 2022 09:48:29 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ozZnu-0003K1-5q; Mon, 28 Nov 2022 03:47:54 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ozZns-0003Jp-RE for guile-user@gnu.org; Mon, 28 Nov 2022 03:47:52 -0500 Original-Received: from sv-2s11.infcs.de ([194.95.66.48] helo=ux-2s-mailproxy.inf.h-brs.de) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ozZnq-00071f-Ud for guile-user@gnu.org; Mon, 28 Nov 2022 03:47:52 -0500 Original-Received: from gyps.h-brs.de (i5C751444.versanet.de [92.117.20.68]) (authenticated bits=0) by ux-2s-mailproxy.inf.h-brs.de (8.15.2/8.15.2/Debian-8ska0) with ESMTPSA id 2AS8le8E001098 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 28 Nov 2022 09:47:42 +0100 X-Auth: by SMTP AUTH @ ux-2s11 X-MIMEDefang-Info-ge: Gescannt in Inf@FH-BRS, Regeln s. MiniFAQ E-Mail/Mailscanner X-Scanned-By: MIMEDefang @ FB02 @ H-BRS Received-SPF: none client-ip=194.95.66.48; envelope-from=alex@soeven.de; helo=ux-2s-mailproxy.inf.h-brs.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, KHOP_HELO_FCRDNS=0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.user:18752 Archived-At: Dear all, I know this topic has been discussed in the past. I found at least one discussion in 2003 in guile-user@gnu.org which in the end referred to even earlier discussions in comp.lang.scheme. But still I'm confused about this and wonder if someone could help with this or point me to a discussion that resolves the following issue. In R5RS it sais about letrec: >Semantics: The =E3=80=88variable=E3=80=89s are bound to fresh locations > holding undefined values, the =E3=80=88init=E3=80=89s are evaluated in the > resulting environment (in some unspecified order), each > =E3=80=88variable=E3=80=89 is assigned to the result of the corresponding > =E3=80=88init=E3=80=89, the =E3=80=88body=E3=80=89 is evaluated in the re= sulting environmet [...] As I (and others) understand=20 > scheme@(guile-user)> (letrec ((b a)(a 7)) b) > $1 =3D 7 should be equivalent (of course in a new scope) to: > scheme@(guile-user)> (define b #nil) > scheme@(guile-user)> (define a #nil) > scheme@(guile-user)> (set! b a) > scheme@(guile-user)> (set! a 7) > scheme@(guile-user)> b > $2 =3D #nil but obviously it is't. Why is b assigned to a's reference rather than it's value in letrec? ... and would it be a correct implementation of R5RS-letrec to return #nil from the letrec above? Cheers, Alex