From unknown Wed Jun 25 03:53:40 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#61660 <61660@debbugs.gnu.org> To: bug#61660 <61660@debbugs.gnu.org> Subject: Status: [feature request] optimization of case-lambda Reply-To: bug#61660 <61660@debbugs.gnu.org> Date: Wed, 25 Jun 2025 10:53:40 +0000 retitle 61660 [feature request] optimization of case-lambda reassign 61660 guile submitter 61660 lloda severity 61660 wishlist tag 61660 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 20 12:56:42 2023 Received: (at submit) by debbugs.gnu.org; 20 Feb 2023 17:56:42 +0000 Received: from localhost ([127.0.0.1]:53462 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pUAP4-0000sw-2p for submit@debbugs.gnu.org; Mon, 20 Feb 2023 12:56:42 -0500 Received: from lists.gnu.org ([209.51.188.17]:41120) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pUAP2-0000so-4C for submit@debbugs.gnu.org; Mon, 20 Feb 2023 12:56:41 -0500 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 1pUAP0-0000ho-AI for bug-guile@gnu.org; Mon, 20 Feb 2023 12:56:39 -0500 Received: from mta-09-3.privateemail.com ([68.65.122.19]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pUAOy-00042R-G9 for bug-guile@gnu.org; Mon, 20 Feb 2023 12:56:37 -0500 Received: from mta-09.privateemail.com (localhost [127.0.0.1]) by mta-09.privateemail.com (Postfix) with ESMTP id 50CA818000A2 for ; Mon, 20 Feb 2023 12:56:28 -0500 (EST) Received: from [192.168.1.105] (unknown [51.154.167.214]) by mta-09.privateemail.com (Postfix) with ESMTPA id E748E18000A1 for ; Mon, 20 Feb 2023 12:56:27 -0500 (EST) From: lloda Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.7\)) Subject: [feature request] optimization of case-lambda Message-Id: <8EDEC1EC-EC48-474D-88A0-9CE25436A961@sarc.name> Date: Mon, 20 Feb 2023 18:56:25 +0100 To: "bug-guile@gnu.org" X-Mailer: Apple Mail (2.3608.120.23.2.7) X-Virus-Scanned: ClamAV using ClamSMTP Received-SPF: pass client-ip=68.65.122.19; envelope-from=lloda@sarc.name; helo=MTA-09-3.privateemail.com 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, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) On 3.0.9 > ,optimize ((case-lambda (() 0))) =3D 0 but=20 > ,optimize ((case-lambda (() 0) ((a) 1))) =3D ((case-lambda (() 0) ((a) 1))) The problem with this is that when the output of a macro contains = case-lambda, recursive application results in geometrical increase of = code size. It seems that it should be possible to resolve the = application on the spot; at last to reduce the case-lambda to a simple = lambda when the arity is available (which now only happens when the = case-lambda contains a single clause). Thanks Daniel From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 23 14:00:16 2023 Received: (at 61660) by debbugs.gnu.org; 23 Feb 2023 19:00:16 +0000 Received: from localhost ([127.0.0.1]:35346 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pVGpD-000061-Rh for submit@debbugs.gnu.org; Thu, 23 Feb 2023 14:00:16 -0500 Received: from mta-09-3.privateemail.com ([68.65.122.19]:25013) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pVGpB-00005j-Tv for 61660@debbugs.gnu.org; Thu, 23 Feb 2023 14:00:14 -0500 Received: from mta-09.privateemail.com (localhost [127.0.0.1]) by mta-09.privateemail.com (Postfix) with ESMTP id 7427F1800234 for <61660@debbugs.gnu.org>; Thu, 23 Feb 2023 14:00:07 -0500 (EST) Received: from [192.168.1.105] (unknown [51.154.167.214]) by mta-09.privateemail.com (Postfix) with ESMTPA id 14EE318000B3 for <61660@debbugs.gnu.org>; Thu, 23 Feb 2023 14:00:06 -0500 (EST) From: lloda Content-Type: multipart/mixed; boundary="Apple-Mail=_F34ADE83-2623-4EDD-B3D7-51826DE61386" Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.7\)) Subject: Re: [feature request] optimization of case-lambda Date: Thu, 23 Feb 2023 20:00:04 +0100 References: To: 61660@debbugs.gnu.org In-Reply-To: Message-Id: X-Mailer: Apple Mail (2.3608.120.23.2.7) X-Virus-Scanned: ClamAV using ClamSMTP X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 61660 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --Apple-Mail=_F34ADE83-2623-4EDD-B3D7-51826DE61386 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii Patch attached, tests tbd. Thoughts? --Apple-Mail=_F34ADE83-2623-4EDD-B3D7-51826DE61386 Content-Disposition: attachment; filename=0001-peval-reduces-some-inlined-case-lambda-calls.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-peval-reduces-some-inlined-case-lambda-calls.patch" Content-Transfer-Encoding: quoted-printable =46rom=20a1f605598a7a49b2971072c8db635b788e209e3a=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20Daniel=20Llorens=20=0ADate:=20= Thu,=2023=20Feb=202023=2017:38:10=20+0100=0ASubject:=20[PATCH]=20peval=20= reduces=20some=20inlined=20case-lambda=20calls=0A=0A*=20= module/language/tree-il/peval.scm=20(peval):=20Reduce=20multiple=20case=20= lambda=0A=20=20in=20=20trees=20according=20to=20the=20number=20of=20= arguments.=20Lambda=20cases=0A=20=20with=20more=20than=20required=20args=20= (either=20optional,=20keyword,=20or=20rest=0A=20=20arguments)=20are=20= ignored.=0A---=0A=20module/language/tree-il/peval.scm=20|=2015=20= +++++++++++++++=0A=201=20file=20changed,=2015=20insertions(+)=0A=0Adiff=20= --git=20a/module/language/tree-il/peval.scm=20= b/module/language/tree-il/peval.scm=0Aindex=207945fd9b9..5c9799edb=20= 100644=0A---=20a/module/language/tree-il/peval.scm=0A+++=20= b/module/language/tree-il/peval.scm=0A@@=20-1668,6=20+1668,21=20@@=20= top-level=20bindings=20from=20ENV=20and=20return=20the=20resulting=20= expression."=0A=20=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20(log=20'inline-end=20result=20exp)=0A=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20result)))))=0A+=20=20=20=20=20=20=20=20=20=20=20= (($=20=20src-proc=20meta=20body)=0A+=20=20=20=20=20=20=20=20=20=20= =20=20;;=20If=20there=20are=20multiple=20cases=20and=20one=20matches=20= nargs,=20omit=20all=20the=20others.=0A+=20=20=20=20=20=20=20=20=20=20=20=20= (or=20(and=20(lambda-case-alternate=20body)=0A+=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20(let=20((nargs=20(length=20orig-args)))=0A+=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(let=20loop=20((body=20= body))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (match=20body=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20(#f=20#f)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20(($=20=20src-body=20req=20opt=20rest=20= kw=20inits=20gensyms=20body=20alt)=0A+=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20(if=20(and=20(not=20opt)=20(not=20= rest)=20(not=20kw)=20(=3D=20nargs=20(length=20req)))=0A+=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (revisit-proc=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20(make-lambda=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20src-proc=20meta=0A+=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20(make-lambda-case=20src-body=20req=20opt=20rest=20kw=20inits=20= gensyms=20body=20#f)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20(loop=20alt)))))))=0A+=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20(make-call=20src=20(for-call=20orig-proc)=20= (map=20for-value=20orig-args))))=0A=20=20=20=20=20=20=20=20=20=20=20=20= (($=20=20_=20_=20_=20vals=20_)=0A=20=20=20=20=20=20=20=20=20=20=20=20= =20;;=20Attempt=20to=20inline=20`let'=20in=20the=20operator=20position.=0A= =20=20=20=20=20=20=20=20=20=20=20=20=20;;=0A--=20=0A2.30.2=0A=0A= --Apple-Mail=_F34ADE83-2623-4EDD-B3D7-51826DE61386-- From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 24 12:26:41 2023 Received: (at 61660) by debbugs.gnu.org; 24 Feb 2023 17:26:41 +0000 Received: from localhost ([127.0.0.1]:38184 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pVbqC-0004YN-PG for submit@debbugs.gnu.org; Fri, 24 Feb 2023 12:26:41 -0500 Received: from mta-14-4.privateemail.com ([198.54.118.206]:5090) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pVbqB-0004Y2-J0 for 61660@debbugs.gnu.org; Fri, 24 Feb 2023 12:26:40 -0500 Received: from mta-14.privateemail.com (localhost [127.0.0.1]) by mta-14.privateemail.com (Postfix) with ESMTP id 7289618000A1 for <61660@debbugs.gnu.org>; Fri, 24 Feb 2023 12:26:32 -0500 (EST) Received: from [192.168.1.105] (unknown [51.154.167.214]) by mta-14.privateemail.com (Postfix) with ESMTPA id E2F4418000A2 for <61660@debbugs.gnu.org>; Fri, 24 Feb 2023 12:26:31 -0500 (EST) From: lloda Content-Type: multipart/mixed; boundary="Apple-Mail=_7C794E26-F35A-419F-96FB-E226E971EBDC" Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.7\)) Subject: Re: bug#61660: [feature request] optimization of case-lambda Date: Fri, 24 Feb 2023 18:26:29 +0100 References: To: 61660@debbugs.gnu.org In-Reply-To: Message-Id: X-Mailer: Apple Mail (2.3608.120.23.2.7) X-Virus-Scanned: ClamAV using ClamSMTP X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 61660 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --Apple-Mail=_7C794E26-F35A-419F-96FB-E226E971EBDC Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii Fixed patch handling rest & #:optional, with test cases. --Apple-Mail=_7C794E26-F35A-419F-96FB-E226E971EBDC Content-Disposition: attachment; filename=0001-peval-reduces-some-inlined-case-lambda-calls.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-peval-reduces-some-inlined-case-lambda-calls.patch" Content-Transfer-Encoding: quoted-printable =46rom=2061ed612fb36108e395bdee4b1bbb46b49ef017b3=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20Daniel=20Llorens=20=0ADate:=20= Thu,=2023=20Feb=202023=2017:38:10=20+0100=0ASubject:=20[PATCH]=20peval=20= reduces=20some=20inlined=20case-lambda=20calls=0A=0A*=20= module/language/tree-il/peval.scm=20(peval):=20Reduce=20multiple=20case=20= lambda=0A=20=20in=20=20trees=20according=20to=20the=20number=20of=20= arguments.=20Do=20not=20try=20to=0A=20=20reduce=20case-lambda=20using=20= keyword=20arguments.=0A*=20test-suite/tests/peval.test:=20Tests.=0A---=0A= =20module/language/tree-il/peval.scm=20|=2023=20++++++++++=0A=20= test-suite/tests/peval.test=20=20=20=20=20=20=20|=2072=20= +++++++++++++++++++++++++++++++=0A=202=20files=20changed,=2095=20= insertions(+)=0A=0Adiff=20--git=20a/module/language/tree-il/peval.scm=20= b/module/language/tree-il/peval.scm=0Aindex=207945fd9b9..7c05e9a2e=20= 100644=0A---=20a/module/language/tree-il/peval.scm=0A+++=20= b/module/language/tree-il/peval.scm=0A@@=20-1668,6=20+1668,29=20@@=20= top-level=20bindings=20from=20ENV=20and=20return=20the=20resulting=20= expression."=0A=20=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20(log=20'inline-end=20result=20exp)=0A=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20result)))))=0A+=20=20=20=20=20=20=20=20=20=20=20= (($=20=20src-proc=20meta=20orig-body)=0A+=20=20=20=20=20=20=20=20= =20=20=20=20;;=20If=20there=20are=20multiple=20cases=20and=20one=20= matches=20nargs,=20omit=20all=20the=20others.=0A+=20=20=20=20=20=20=20=20= =20=20=20=20(or=20(and=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20(lambda-case-alternate=20orig-body)=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20(let=20((nargs=20(length=20orig-args)))=0A+=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(let=20loop=20((body=20= orig-body))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20(match=20body=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20(#f=20#f)=20;;=20No=20matching=20case;=20an=20error.=0A+=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(($=20= =20src-case=20req=20opt=20rest=20kw=20inits=20gensyms=20= case-body=20alt)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20(cond=20(kw=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20;;=20FIXME:=20Not=20= handling=20keyword=20cases.=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20#f)=0A+=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= ((let=20((nreq=20(length=20req)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(if=20= rest=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20(<=3D=20nreq=20nargs)=0A+=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20(<=3D=20nreq=20nargs=20(+=20nreq=20(if=20opt=20= (length=20opt)=200)))))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20;;=20Keep=20only=20this=20= case.=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20(revisit-proc=0A+=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (make-lambda=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20src-proc=20meta=0A+=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20(make-lambda-case=20src-case=20req=20opt=20rest=20kw=20inits=20= gensyms=20case-body=20#f))))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(else=20(loop=20= alt))))))))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (make-call=20src=20(for-call=20orig-proc)=20(map=20for-value=20= orig-args))))=0A=20=20=20=20=20=20=20=20=20=20=20=20(($=20=20_=20_=20= _=20vals=20_)=0A=20=20=20=20=20=20=20=20=20=20=20=20=20;;=20Attempt=20to=20= inline=20`let'=20in=20the=20operator=20position.=0A=20=20=20=20=20=20=20=20= =20=20=20=20=20;;=0Adiff=20--git=20a/test-suite/tests/peval.test=20= b/test-suite/tests/peval.test=0Aindex=20a2e4975d9..8a8f0124a=20100644=0A= ---=20a/test-suite/tests/peval.test=0A+++=20= b/test-suite/tests/peval.test=0A@@=20-1456,6=20+1456,78=20@@=0A=20=20=20=20= =20;;=20.=0A=20=20=20=20=20(primcall=20= make-vector)))=0A=20=0A+(with-test-prefix=20"case-lambda"=0A+=20=20;;=20= one=20case=0A+=20=20(pass-if-peval=0A+=20=20=20((case-lambda=20(()=20= 0)))=0A+=20=20=20(const=200))=0A+=0A+=20=20;;=20middle=0A+=20=20= (pass-if-peval=0A+=20=20=20((case-lambda=20(()=200)=20((a=20b)=201)=20= ((a)=202))=201=202)=0A+=20=20=20(const=201))=0A+=0A+=20=20;;=20last=0A+=20= =20(pass-if-peval=0A+=20=20=20((case-lambda=20((a=20b)=200)=20((a)=201)=20= (()=202)))=0A+=20=20=20(const=202))=0A+=0A+=20=20;;=20first=0A+=20=20= (pass-if-peval=0A+=20=20=20((case-lambda=20((a)=200)=20(()=201)=20((a=20= b)=202))=201)=0A+=20=20=20(const=200))=0A+=0A+=20=20;;=20rest=20arg=0A+=20= =20(pass-if-peval=0A+=20=20=20((case-lambda=20(args=200)=20((a=20b)=201)=20= ((a)=202))=201=202)=0A+=20=20=20(const=200))=0A+=0A+=20=20;;=20req=20= before=20rest=20I=0A+=20=20(pass-if-peval=0A+=20=20=20((case-lambda=20= ((a=20b)=200)=20(args=201)=20((a)=201))=201=202)=0A+=20=20=20(const=20= 0))=0A+=0A+=20=20;;=20req=20before=20rest=20II=0A+=20=20(pass-if-peval=0A= +=20=20=20((case-lambda=20((a)=200)=20(args=201)=20((a=20b)=202))=201=20= 2)=0A+=20=20=20(const=201))=0A+=0A+=20=20;;=20optional=0A+=20=20= (pass-if-peval=0A+=20=20=20((case-lambda*=20((a=20#:optional=20x)=200)=20= (args=201)=20((a)=202))=201=202)=0A+=20=20=20(const=200))=0A+=0A+=20=20= ;;=20optional=20and=20rest,=20no=20match=20I=0A+=20=20(pass-if-peval=0A+=20= =20=20((case-lambda*=20((a=20#:optional=20x=20.=20rest)=200)=20(args=20= 1)=20((a)=202)))=0A+=20=20=20(const=201))=0A+=0A+=20=20;;=20optional=20= and=20rest,=20match=20I=0A+=20=20(pass-if-peval=0A+=20=20=20= ((case-lambda*=20(()=200)=20((a=20#:optional=20x=20.=20rest)=201)=20((a)=20= 2))=201)=0A+=20=20=20(const=201))=0A+=0A+=20=20;;=20optional=20and=20= rest,=20match=20II=0A+=20=20(pass-if-peval=0A+=20=20=20((case-lambda*=20= ((a=20#:optional=20x=20.=20rest)=200)=20(args=201)=20((a)=202))=201)=0A+=20= =20=20(const=200))=0A+=0A+=20=20;;=20optional=20and=20rest,=20match=20= III=0A+=20=20(pass-if-peval=0A+=20=20=20((case-lambda*=20((a=20= #:optional=20x=20.=20rest)=200)=20(args=201)=20((a)=202))=201=202)=0A+=20= =20=20(const=200))=0A+=0A+=20=20;;=20optional=20and=20rest,=20match=20IV=0A= +=20=20(pass-if-peval=0A+=20=20=20((case-lambda*=20((a=20#:optional=20x=20= .=20rest)=200)=20(args=201)=20((a)=202))=201=202=203)=0A+=20=20=20(const=20= 0))=0A+=0A+=20=20;;=20keyword=20cases=20survive=0A+=20=20(pass-if=20(=3D=20= 1=20((case-lambda*=20((a=20b)=200)=20((a=20#:key=20x)=201))=200=20#:x=20= 1)))=0A+=20=20(pass-if=20(=3D=200=20((case-lambda*=20((a=20b=20c)=200)=20= ((a=20#:key=20x)=201))=200=20#:x=201)))=0A+=20=20(pass-if=20(=3D=200=20= ((case-lambda*=20((a=20#:key=20x)=200)=20((a=20b)=200))=200=20#:x=201)))=0A= +=20=20(pass-if=20(=3D=201=20((case-lambda*=20((a=20#:key=20x)=200)=20= ((a=20b=20c)=201))=200=201=202))))=0A+=0A=20(with-test-prefix=20"eqv?"=0A= =20=20=20(pass-if-peval=20(eqv?=20x=20#f)=0A=20=20=20=20=20(primcall=20= eq?=20(toplevel=20x)=20(const=20#f)))=0A--=20=0A2.30.2=0A=0A= --Apple-Mail=_7C794E26-F35A-419F-96FB-E226E971EBDC-- From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 27 05:06:55 2023 Received: (at control) by debbugs.gnu.org; 27 Feb 2023 10:06:55 +0000 Received: from localhost ([127.0.0.1]:46069 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWaPG-0006vy-RQ for submit@debbugs.gnu.org; Mon, 27 Feb 2023 05:06:55 -0500 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:33395) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWaPE-0006vj-4W for control@debbugs.gnu.org; Mon, 27 Feb 2023 05:06:53 -0500 Authentication-Results: mail2-relais-roc.national.inria.fr; dkim=none (message not signed) header.i=none; spf=SoftFail smtp.mailfrom=ludo@gnu.org; dmarc=fail (p=none dis=none) d=gnu.org X-IronPort-AV: E=Sophos;i="5.97,331,1669071600"; d="scan'208";a="94478215" Received: from unknown (HELO ribbon) ([193.50.110.164]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Feb 2023 11:06:42 +0100 Date: Mon, 27 Feb 2023 11:06:43 +0100 Message-Id: <87ilfno218.fsf@gnu.org> To: control@debbugs.gnu.org From: =?utf-8?Q?Ludovic_Court=C3=A8s?= Subject: control message for bug #61660 MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) tags 61660 + patch quit From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 27 05:11:40 2023 Received: (at 61660) by debbugs.gnu.org; 27 Feb 2023 10:11:40 +0000 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 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 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==; 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 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: lloda Subject: Re: bug#61660: [feature request] optimization of case-lambda References: Date: Mon, 27 Feb 2023 11:11:29 +0100 In-Reply-To: (lloda@sarc.name's message of "Fri, 24 Feb 2023 18:26:29 +0100") Message-ID: <87edqbo1ta.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 61660 Cc: 61660@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) 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. From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 27 12:19:57 2023 Received: (at 61660-done) by debbugs.gnu.org; 27 Feb 2023 17:19:57 +0000 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 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 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) 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) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.7\)) Subject: Re: bug#61660: [feature request] optimization of case-lambda From: lloda In-Reply-To: <87edqbo1ta.fsf@gnu.org> Date: Mon, 27 Feb 2023 18:19:42 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: References: <87edqbo1ta.fsf@gnu.org> To: =?utf-8?Q?Ludovic_Court=C3=A8s?= X-Mailer: Apple Mail (2.3608.120.23.2.7) X-Virus-Scanned: ClamAV using ClamSMTP X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 61660-done Cc: 61660-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > 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 From unknown Wed Jun 25 03:53:40 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 28 Mar 2023 11:24:11 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator