From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: lloda Newsgroups: gmane.lisp.guile.bugs Subject: bug#61660: [feature request] optimization of case-lambda Date: Mon, 27 Feb 2023 18:19:42 +0100 Message-ID: References: <87edqbo1ta.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.7\)) 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="28090"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 61660-done@debbugs.gnu.org To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Mon Feb 27 18:20:25 2023 Return-path: Envelope-to: guile-bugs@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 1pWhAn-000742-Ra for guile-bugs@m.gmane-mx.org; Mon, 27 Feb 2023 18:20:25 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pWhAU-0006D2-CA; Mon, 27 Feb 2023 12:20:06 -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 1pWhAQ-0006AA-GZ for bug-guile@gnu.org; Mon, 27 Feb 2023 12:20:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pWhAQ-0006Er-7w for bug-guile@gnu.org; Mon, 27 Feb 2023 12:20:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pWhAQ-0006dX-2C for bug-guile@gnu.org; Mon, 27 Feb 2023 12:20:02 -0500 Resent-From: lloda Original-Sender: "Debbugs-submit" Resent-To: bug-guile@gnu.org Resent-Date: Mon, 27 Feb 2023 17:20:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 61660 X-GNU-PR-Package: guile X-GNU-PR-Keywords: patch Mail-Followup-To: 61660@debbugs.gnu.org, lloda@sarc.name, lloda@sarc.name Original-Received: via spool by 61660-done@debbugs.gnu.org id=D61660.167751839725490 (code D ref 61660); Mon, 27 Feb 2023 17:20:01 +0000 Original-Received: (at 61660-done) by debbugs.gnu.org; 27 Feb 2023 17:19:57 +0000 Original-Received: from localhost ([127.0.0.1]:48700 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWhAK-0006d1-H2 for submit@debbugs.gnu.org; Mon, 27 Feb 2023 12:19:56 -0500 Original-Received: from mta-07-4.privateemail.com ([68.65.122.27]:18609) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWhAG-0006cn-Rp for 61660-done@debbugs.gnu.org; Mon, 27 Feb 2023 12:19:55 -0500 Original-Received: from mta-07.privateemail.com (localhost [127.0.0.1]) by mta-07.privateemail.com (Postfix) with ESMTP id E7C6818000AA; Mon, 27 Feb 2023 12:19:46 -0500 (EST) Original-Received: from [192.168.1.105] (unknown [51.154.167.214]) by mta-07.privateemail.com (Postfix) with ESMTPA id 5825A18000A3; Mon, 27 Feb 2023 12:19:45 -0500 (EST) In-Reply-To: <87edqbo1ta.fsf@gnu.org> X-Mailer: Apple Mail (2.3608.120.23.2.7) X-Virus-Scanned: ClamAV using ClamSMTP X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.bugs:10559 Archived-At: > On 27 Feb 2023, at 11:11, Ludovic Court=C3=A8s wrote: >=20 > Hi Daniel, >=20 > lloda skribis: >=20 >> =46rom 61ed612fb36108e395bdee4b1bbb46b49ef017b3 Mon Sep 17 00:00:00 = 2001 >> From: Daniel Llorens >> Date: Thu, 23 Feb 2023 17:38:10 +0100 >> Subject: [PATCH] peval reduces some inlined case-lambda calls >>=20 >> * module/language/tree-il/peval.scm (peval): Reduce multiple case = lambda >> in trees according to the number of arguments. Do not try to >> reduce case-lambda using keyword arguments. >> * test-suite/tests/peval.test: Tests. >=20 > [...] >=20 >> +++ b/module/language/tree-il/peval.scm >> @@ -1668,6 +1668,29 @@ top-level bindings from ENV and return the = resulting expression." >>=20 >> (log 'inline-end result exp) >> result))))) >> + (($ src-proc meta orig-body) >> + ;; If there are multiple cases and one matches nargs, = omit all the others. >> + (or (and >> + (lambda-case-alternate orig-body) >> + (let ((nargs (length orig-args))) >> + (let loop ((body orig-body)) >> + (match body >> + (#f #f) ;; No matching case; an error. >> + (($ src-case req opt rest kw = inits gensyms case-body alt) >> + (cond (kw >> + ;; FIXME: Not handling keyword cases. >> + #f) >=20 > Maybe s/FIXME/XXX/ since it=E2=80=99s at most a limitation, certainly = not a bug. >=20 > It LGTM and Andy already approved it on IRC, so go ahead! >=20 > Ludo=E2=80=99. Apologies for not seeing this earlier. Pushed to = 3b47f87618047ebb8812788c64a44877a4f2e0dd. Thanks! - Daniel