From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Newsgroups: gmane.lisp.guile.bugs Subject: bug#61660: [feature request] optimization of case-lambda Date: Mon, 27 Feb 2023 11:11:29 +0100 Message-ID: <87edqbo1ta.fsf@gnu.org> References: 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="24970"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) Cc: 61660@debbugs.gnu.org To: lloda Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Mon Feb 27 11:12:27 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 1pWaUd-0006Bb-3b for guile-bugs@m.gmane-mx.org; Mon, 27 Feb 2023 11:12:27 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pWaUH-0004GR-5V; Mon, 27 Feb 2023 05:12:05 -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 1pWaUE-0004EI-Oi for bug-guile@gnu.org; Mon, 27 Feb 2023 05:12: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 1pWaUE-0000Pf-GG for bug-guile@gnu.org; Mon, 27 Feb 2023 05:12:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pWaUE-00073z-CT for bug-guile@gnu.org; Mon, 27 Feb 2023 05:12:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Mon, 27 Feb 2023 10:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61660 X-GNU-PR-Package: guile X-GNU-PR-Keywords: patch Original-Received: via spool by 61660-submit@debbugs.gnu.org id=B61660.167749270027118 (code B ref 61660); Mon, 27 Feb 2023 10:12:02 +0000 Original-Received: (at 61660) by debbugs.gnu.org; 27 Feb 2023 10:11:40 +0000 Original-Received: from localhost ([127.0.0.1]:46078 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWaTr-00073K-P5 for submit@debbugs.gnu.org; Mon, 27 Feb 2023 05:11:40 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:51904) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWaTp-000734-9O for 61660@debbugs.gnu.org; Mon, 27 Feb 2023 05:11:38 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pWaTj-0000Gl-Ky; Mon, 27 Feb 2023 05:11:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=xRCB5Isr73KMBhzrAwM/J4yJbX5uZ7bLg79ADNmpurA=; b=YZsCMjIpE4EaXy+XzbIa 0T6D3pCZbCf5G59usBAKGgK3za6qrIzQnjyBJR2paBUneJ9NlKmvf3EuXXyxdqqckls5G2DBglhQH xsap9GnENTRes9xT2fPSnX4zVB/WC30cv1iVM6HP9qwIfwqcsoIWgXhTdplYWheylYuHhPTRwYgCh K9JbhPFbckF7HLn8K7QIrehUJrfnmULfiKzyu5SudNHwDrg7J1AOeMVnthhPa9EZWdJKOGFP2S63H pjzW394ya60BRuxKPn1nvqag3gpUW3F1NPm+TGVfjzUoXEkcqFCNtOPHBgZYohMqU+htFex7HNuEh qLFUz7iDXJfGFg==; Original-Received: from [193.50.110.164] (helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pWaTj-0008Lc-5H; Mon, 27 Feb 2023 05:11:31 -0500 In-Reply-To: (lloda@sarc.name's message of "Fri, 24 Feb 2023 18:26:29 +0100") 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:10558 Archived-At: Hi Daniel, lloda skribis: > From 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 > > * 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. [...] > +++ b/module/language/tree-il/peval.scm > @@ -1668,6 +1668,29 @@ top-level bindings from ENV and return the resulti= ng expression." >=20=20 > (log 'inline-end result exp) > result))))) > + (($ src-proc meta orig-body) > + ;; If there are multiple cases and one matches nargs, omit a= ll 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) Maybe s/FIXME/XXX/ since it=E2=80=99s at most a limitation, certainly not a= bug. It LGTM and Andy already approved it on IRC, so go ahead! Ludo=E2=80=99.