From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Tim Gesthuizen via "Bug reports for GUILE, GNU's Ubiquitous Extension Language" Newsgroups: gmane.lisp.guile.bugs Subject: bug#38263: Bug in srfi-11 (?) Date: Mon, 18 Nov 2019 21:01:17 +0100 Message-ID: <87r2250x9u.fsf@yahoo.de> References: <87r2250x9u.fsf.ref@yahoo.de> Reply-To: Tim Gesthuizen Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="155223"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: mu4e 1.2.0; emacs 26.3 To: 38263@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Mon Nov 18 21:02:24 2019 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iWnE5-000e9W-SN for guile-bugs@m.gmane.org; Mon, 18 Nov 2019 21:02:22 +0100 Original-Received: from localhost ([::1]:38696 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iWnE4-0001G8-PD for guile-bugs@m.gmane.org; Mon, 18 Nov 2019 15:02:20 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51917) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iWnDo-0001Ec-VJ for bug-guile@gnu.org; Mon, 18 Nov 2019 15:02:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iWnDn-0004dT-2b for bug-guile@gnu.org; Mon, 18 Nov 2019 15:02:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:37466) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iWnDm-0004dL-V4 for bug-guile@gnu.org; Mon, 18 Nov 2019 15:02:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iWnDm-0002aE-DZ for bug-guile@gnu.org; Mon, 18 Nov 2019 15:02:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Tim Gesthuizen Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Mon, 18 Nov 2019 20:02:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 38263 X-GNU-PR-Package: guile X-Debbugs-Original-To: bug-guile@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.15741072909885 (code B ref -1); Mon, 18 Nov 2019 20:02:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 18 Nov 2019 20:01:30 +0000 Original-Received: from localhost ([127.0.0.1]:46287 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iWnDG-0002ZN-2P for submit@debbugs.gnu.org; Mon, 18 Nov 2019 15:01:30 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:38771) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iWnDE-0002ZF-5n for submit@debbugs.gnu.org; Mon, 18 Nov 2019 15:01:28 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51811) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iWnDC-0001BE-LV for bug-guile@gnu.org; Mon, 18 Nov 2019 15:01:27 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iWnDB-0004Vb-2s for bug-guile@gnu.org; Mon, 18 Nov 2019 15:01:26 -0500 Original-Received: from sonic313-21.consmr.mail.ir2.yahoo.com ([77.238.179.188]:36558) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iWnDA-0004Ux-K3 for bug-guile@gnu.org; Mon, 18 Nov 2019 15:01:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.de; s=s2048; t=1574107281; bh=itoZtu/0AwuOMPouHshucJIkqK3Id+GmbYUmVWWCebc=; h=From:To:Subject:Date:References:From:Subject; b=bmt0EFOdg17Wxla9W5IMc9HhNQGgan+GhglfeVfu0QI8ug9KtxP77dZyQdsLtGZY29aGCbFL9ogjPRUPEiZcya+AY79/47BvbUYICAECrie3HqO6UuHEvJZoe1tw4ebYr7sJ6ha+JXY/R9zW0yYY4oy6M/+konXSQAPO16m6qTFxzUXFf0ltLp1EWEUO0iH35fU/190xFN58y42nBCjWB1uaQDWMuwZwvEU01fNwrSddFtQgKdyrMEABkYIZghTjPa6SvektolzV6BXpWlldY8tngrWITXySZDsXTokTPhNYHoQAO54kQT5GEnkwrcnqkuAZkNL2ULGPCNEENsZlpQ== X-YMail-OSG: y9ljF1wVM1n5QJaQvs_HzWUuudRDpArM.vkXq0u.Gl6d1VyPljoJRkuUbjBTlWj gcEbXoCk.oaimnY0UzYv4f.WxGG18GSAnKFQHit8LRq9hs1_5Erse67ooshVrznwM6j3sCdm68gU ZvD8Vpjw8FNDe5uhVgEfY6j2wMXzgFNgc4e8xWi0SI1z4dE6OIEeIhBb.6j1cQHKaF.9OtACngBR nnC.gV4i5o5YD.kW_EDM.bAoEfQciZXVoHoQBw9VJSfZXsTer6Petec.qd5hHttZV846fkj8aDno TjM01ZyihgLRgtGsYFUfs7QueeShzVYWxeFuX4HV2iwa2P498p.R6esOqE7NuBA55SIRo0MP2CB5 2YEtt2e1QdorwLDT74cXqzpYidtnnEeAA.cw2GC60_TgV9dAn4KwxMX7v967MR0Xhvm7o1.Cza8J Lvrvx1EcWD56lLnv0xYsXw8I3EfaprmbztdLpQstLQuOWH4x97y5ACVOL2FKTre942786sUfD3ko 80ntIJNi77CXK24iIvb9bIdNhtOIum3izyFjpt6vh9z3vy8H5sg_w5mgm8WR0MZMg2HR_ARbnFV_ .8jBiga5FvFJHCVyBmYL0Bzh00eBdhVEvWrfqhnHk.UwzVGmnD7tRHRVRDSURblf1xXg2Icl1yAK K1eNcfQs1.MCBm73sTql7i5RJnjNbArnbfPGC0NfmtV57n9zOy.cO6Na.3FWpguHFBR5Y6hgkghH CKnWB.ahDhSUFXVFeuDRkbryn4DWWe9IPuBT26HPnVixcV6qNbTXGGP0zyoGE4Cpt6lh6TKfHrfA iFy1_zhzerBrPxBM7tmugFzeuCUuRG85wTkeHDzOua Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic313.consmr.mail.ir2.yahoo.com with HTTP; Mon, 18 Nov 2019 20:01:21 +0000 Original-Received: by smtp429.mail.ir2.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 4d0c28c81f8920309ac1104ce581c019; Mon, 18 Nov 2019 20:01:19 +0000 (UTC) X-Mailer: WebService/1.1.14728 hermes Apache-HttpAsyncClient/4.1.4 (Java/1.8.0_181) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: "bug-guile" Xref: news.gmane.org gmane.lisp.guile.bugs:9455 Archived-At: Hi, I was tinkering with srfi-11 and was wondering whether the following is correct: > scheme@(guile-user)> ,expand (let-values (((a b c) (values 1 2 3)) > ((d . e) (values 4 5))) > (list a b c d e)) > $26 = ((@@ (srfi srfi-11) call-with-values) > (lambda () (values 1 2 3)) > (lambda (t-1dff1b83541ce327-16e > t-1dff1b83541ce327-16f > t-1dff1b83541ce327-170) > ((@@ (srfi srfi-11) call-with-values) > (lambda () (values 4 5)) > (lambda (d . e) > (let ((t-1dff1b83541ce327-171 d) > (t-1dff1b83541ce327-172 e) > (a t-1dff1b83541ce327-16e) > (b t-1dff1b83541ce327-16f) > (c t-1dff1b83541ce327-170)) > (list a b c d e)))))) This differs from what the comment above the macro definition claims to expand to. It seems like the author forgot that he matched the temporaries before the variables in srfi-11.scm:94. > diff --git a/module/srfi/srfi-11.scm b/module/srfi/srfi-11.scm > index 22bda21a2..13a2ffc4d 100644 > --- a/module/srfi/srfi-11.scm > +++ b/module/srfi/srfi-11.scm > @@ -95,13 +95,13 @@ > (let lp ((vars (syntax vars))) > (syntax-case vars () > ((id . rest) > - (acons (syntax id) > - (car > + (acons (car > (generate-temporaries (syntax (id)))) > + (syntax id) > (lp (syntax rest)))) > - (id (acons (syntax id) > - (car > + (id (acons (car > (generate-temporaries (syntax (id)))) > + (syntax id) > '()))))) > ((id ...) ids) > ((tmp ...) tmps)) The code "works" anyhow because the lambdas are all nested and the inner ones capture the parameters of the outer ones. Which got me thinking why all the messing with temporaries is neccessary at all. Why is > (define-syntax let-values > (lambda (x) > (syntax-case x () > ((_ (clauses ...) b0 b1 ...) > (let lp ((clauses #'(clauses ...))) > (if (null? clauses) > #'(begin b0 b1 ...) > (syntax-case (car clauses) () > ((args exp) > (with-syntax ((inner (lp (cdr clauses)))) > #'(call-with-values (lambda () exp) > (lambda args inner))))))))))) not sufficient? I would not consider my self a Scheme expert and it could be that I just missed something. It would be nice if someone could verify whether this is a bug or not. I am using Guile 2.2.6 on Guix. Tim.