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.devel Subject: Re: Add internal definitions to derived forms Date: Fri, 20 Jan 2023 18:37:48 +0100 Message-ID: References: <2f38c5ea-0cb6-494e-b680-70b39c3291fb@app.fastmail.com> <38A58B58-3E5C-48EA-A108-1255982789DF@sarc.name> <39109fe3-4f7f-8d07-51ba-f9f993ab5c0d@lassi.io> <8187541f-a4e0-2f26-e8b7-df7fb82bb9f0@lassi.io> <2ffeb6fa-87eb-4008-9881-91b3e71a1fc3@app.fastmail.com> Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.7\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_3AA9A889-F3FF-4351-AFA5-80BA3D8D9F67" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5267"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Lassi Kortela , "guile-devel@gnu.org" To: =?utf-8?Q?Linus_Bj=C3=B6rnstam?= Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Fri Jan 20 18:38:59 2023 Return-path: Envelope-to: guile-devel@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 1pIvLu-0001AM-GV for guile-devel@m.gmane-mx.org; Fri, 20 Jan 2023 18:38:58 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pIvLa-0005vl-UD; Fri, 20 Jan 2023 12:38:40 -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 1pIvLL-0005kj-Ce for guile-devel@gnu.org; Fri, 20 Jan 2023 12:38:23 -0500 Original-Received: from mta-15-4.privateemail.com ([198.54.127.111]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pIvLJ-0000Iv-8X for guile-devel@gnu.org; Fri, 20 Jan 2023 12:38:23 -0500 Original-Received: from mta-15.privateemail.com (localhost [127.0.0.1]) by mta-15.privateemail.com (Postfix) with ESMTP id 5B1D118000A3; Fri, 20 Jan 2023 12:37:53 -0500 (EST) Original-Received: from [192.168.1.105] (unknown [51.154.167.214]) by mta-15.privateemail.com (Postfix) with ESMTPA id 2A75918000A9; Fri, 20 Jan 2023 12:37:49 -0500 (EST) In-Reply-To: X-Mailer: Apple Mail (2.3608.120.23.2.7) X-Virus-Scanned: ClamAV using ClamSMTP Received-SPF: pass client-ip=198.54.127.111; envelope-from=lloda@sarc.name; helo=MTA-15-4.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-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.devel:21600 Archived-At: --Apple-Mail=_3AA9A889-F3FF-4351-AFA5-80BA3D8D9F67 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On 19 Jan 2023, at 18:54, lloda wrote: >=20 > Attached a patch that applies after yours and refers to the = explanation of bodies elsewhere in the manual. Wdyt? Second version, fixes text for the same type of body for other forms. Regards Daniel --Apple-Mail=_3AA9A889-F3FF-4351-AFA5-80BA3D8D9F67 Content-Disposition: attachment; filename=0002-Fix-documentation-for-forms-taking-lambda-like-bodie.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0002-Fix-documentation-for-forms-taking-lambda-like-bodie.patch" Content-Transfer-Encoding: quoted-printable =46rom=207aea299373f7370f31c9701035260ad412763724=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20Daniel=20Llorens=20=0ADate:=20= Thu,=2019=20Jan=202023=2016:23:29=20+0100=0ASubject:=20[PATCH=202/2]=20= Fix=20documentation=20for=20forms=20taking=20lambda-like=20bodies=0A=0A*=20= doc/ref/api-control.texi=20(Conditionals):=20Use=20'body'=20in=20the=20= syntax=0A=20=20description=20of=20when,=20unless,=20cond,=20case.=0A*=20= doc/ref/api-binding.texi=20(Local=20Bindings):=20Normalize=20description=20= of=0A=20=20body=20return=20values.=0A=20=20(Multiple=20values):=20= Normalize=20use=20of=20'body'=20and=20description=20of=20body=0A=20=20= return=20values.=0A---=0A=20doc/ref/api-binding.texi=20|=20=206=20+++--=0A= =20doc/ref/api-control.texi=20|=2051=20= +++++++++++++++++++---------------------=0A=202=20files=20changed,=2028=20= insertions(+),=2029=20deletions(-)=0A=0Adiff=20--git=20= a/doc/ref/api-binding.texi=20b/doc/ref/api-binding.texi=0Aindex=20= 60f034a0e..2fa1366d2=20100644=0A---=20a/doc/ref/api-binding.texi=0A+++=20= b/doc/ref/api-binding.texi=0A@@=20-128,6=20+128,8=20@@=20expressions=20= has=20a=20few=20properties=20which=20are=20well=20worth=20knowing.=0A=20=0A= =20The=20most=20basic=20local=20binding=20construct=20is=20@code{let}.=0A= =20=0A+@cindex=20body=0A+=0A=20@deffn=20syntax=20let=20bindings=20body=0A= =20@var{bindings}=20has=20the=20form=0A=20=0A@@=20-151,8=20+153,8=20@@=20= New=20storage=20is=20allocated=20for=20the=20@var{variables}.=0A=20The=20= values=20of=20the=20@var{init}=20expressions=20are=20stored=20into=20the=20= variables.=0A=20=0A=20@item=0A-The=20expressions=20in=20@var{body}=20are=20= evaluated=20in=20order,=20and=20the=20value=20of=0A-the=20last=20= expression=20is=20returned=20as=20the=20value=20of=20the=20@code{let}=0A= +The=20expressions=20in=20@var{body}=20are=20evaluated=20in=20order,=20= and=20the=20values=20of=0A+the=20last=20expression=20are=20returned=20as=20= the=20result=20of=20the=20@code{let}=0A=20expression.=0A=20@end=20= itemize=0A=20=0Adiff=20--git=20a/doc/ref/api-control.texi=20= b/doc/ref/api-control.texi=0Aindex=20ece6a6020..d04ec49b6=20100644=0A---=20= a/doc/ref/api-control.texi=0A+++=20b/doc/ref/api-control.texi=0A@@=20= -47,8=20+47,8=20@@=20output=20port,=20then=20display=20a=20newline.=20=20= We=20use=20@code{begin}=20to=20form=20a=0A=20compound=20expression=20out=20= of=20this=20sequence=20of=20sub-expressions.=0A=20=0A=20@deffn=20syntax=20= begin=20expr=20@dots{}=0A-The=20expression(s)=20are=20evaluated=20in=20= left-to-right=20order=20and=20the=20value=20of=0A-the=20last=20= expression=20is=20returned=20as=20the=20value=20of=20the=0A+The=20= expression(s)=20are=20evaluated=20in=20left-to-right=20order=20and=20the=20= values=20of=0A+the=20last=20expression=20are=20returned=20as=20the=20= result=20of=20the=0A=20@code{begin}-expression.=20=20This=20expression=20= type=20is=20used=20when=20the=0A=20expressions=20before=20the=20last=20= one=20are=20evaluated=20for=20their=20side=20effects.=0A=20@end=20deffn=0A= @@=20-117,7=20+117,7=20@@=20abuses=20the=20@code{begin}=20form=20for=20= these=20two=20tasks.=0A=20=0A=20Guile=20provides=20three=20syntactic=20= constructs=20for=20conditional=20evaluation.=0A=20@code{if}=20is=20the=20= normal=20if-then-else=20expression=20(with=20an=20optional=20else=0A= -branch),=20@code{cond}=20is=20a=20conditional=20expression=20with=20= multiple=20branches=0A+branch),=20@code{cond}=20is=20a=20conditional=20= expression=20with=20multiple=20branches,=0A=20and=20@code{case}=20= branches=20if=20an=20expression=20has=20one=20of=20a=20set=20of=20= constant=0A=20values.=0A=20=0A@@=20-141,14=20+141,14=20@@=20expression.=20= =20(By=20convention,=20we=20use=20the=20word=20@dfn{statement}=20to=20= refer=20to=0A=20an=20expression=20that=20is=20evaluated=20for=20effect,=20= not=20for=20value).=0A=20=0A=20In=20such=20a=20case,=20it=20is=20= considered=20more=20clear=20to=20express=20these=20intentions=0A-with=20= these=20special=20forms,=20@code{when}=20and=20@code{unless}.=20=20As=20= an=20added=0A-bonus,=20these=20forms=20accept=20multiple=20statements=20= to=20evaluate,=20which=20are=0A-implicitly=20wrapped=20in=20a=20= @code{begin}.=0A+with=20the=20special=20forms=20@code{when}=20and=20= @code{unless}.=20=20As=20an=20added=0A+bonus,=20these=20forms=20take=20a=20= @ref{Local=20Bindings,lambda-like=20body},=20which=20can=0A+contain=20= @ref{Internal=20Definitions,internal=20definitions}=20and=20multiple=20= statements=0A+to=20evaluate.=0A=20=0A-@deffn=20{Scheme=20Syntax}=20when=20= test=20statement1=20statement2=20...=0A-@deffnx=20{Scheme=20Syntax}=20= unless=20test=20statement1=20statement2=20...=0A-The=20actual=20= definitions=20of=20these=20forms=20are=20in=20many=20ways=20their=20most=20= clear=0A-documentation:=0A+@deffn=20{Scheme=20Syntax}=20when=20test=20= body=0A+@deffnx=20{Scheme=20Syntax}=20unless=20test=20body=0A+The=20= actual=20definitions=20of=20these=20forms=20may=20be=20their=20most=20= clear=20documentation:=0A=20=0A=20@example=0A=20(define-syntax-rule=20= (when=20test=20stmt=20stmt*=20...)=0A@@=20-167,11=20+167,10=20@@=20= statements=20if=20@var{test}=20is=20false.=0A=20Each=20= @code{cond}-clause=20must=20look=20like=20this:=0A=20=0A=20@lisp=0A= -(@var{test}=20@var{body}=20@dots{})=0A+(@var{test}=20@var{body})=0A=20= @end=20lisp=0A=20=0A-where=20@var{test}=20is=20an=20arbitrary=20= expression=20and=20@var{body}=20is=20a=0A-lambda-like=20body,=20or=20= like=20this=0A+where=20@var{test}=20is=20an=20arbitrary=20expression,=20= or=20like=20this=0A=20=0A=20@lisp=0A=20(@var{test}=20=3D>=20= @var{expression})=0A@@=20-180,9=20+179,9=20@@=20lambda-like=20body,=20or=20= like=20this=0A=20where=20@var{expression}=20must=20evaluate=20to=20a=20= procedure.=0A=20=0A=20The=20@var{test}s=20of=20the=20clauses=20are=20= evaluated=20in=20order=20and=20as=20soon=20as=20one=0A-of=20them=20= evaluates=20to=20a=20true=20value,=20the=20corresponding=20= @var{expression}s=0A-are=20evaluated=20in=20order=20and=20the=20last=20= value=20is=20returned=20as=20the=20value=20of=0A-the=20= @code{cond}-expression.=20=20For=20the=20@code{=3D>}=20clause=20type,=0A= +of=20them=20evaluates=20to=20a=20true=20value,=20the=20corresponding=20= @var{body}=20is=0A+evaluated=20to=20produce=20the=20result=20of=20the=20= @code{cond}-expression.=20=20For=20the=0A+@code{=3D>}=20clause=20type,=0A= =20@var{expression}=20is=20evaluated=20and=20the=20resulting=20procedure=20= is=20applied=20to=0A=20the=20value=20of=20@var{test}.=20=20The=20result=20= of=20this=20procedure=20application=20is=0A=20then=20the=20result=20of=20= the=20@code{cond}-expression.=0A@@=20-209,7=20+208,7=20@@=20procedure=20= to=20the=20value(s)=20of=20@var{test},=20in=20the=20same=20manner=20as=20= the=0A=20=0A=20The=20@var{test}=20of=20the=20last=20@var{clause}=20may=20= be=20the=20symbol=20@code{else}.=0A=20Then,=20if=20none=20of=20the=20= preceding=20@var{test}s=20is=20true,=20the=0A-@var{expression}s=20= following=20the=20@code{else}=20are=20evaluated=20to=20produce=20the=0A= +@var{body}=20following=20the=20@code{else}=20is=20evaluated=20to=20= produce=20the=0A=20result=20of=20the=20@code{cond}-expression.=0A=20@end=20= deffn=0A=20=0A@@=20-217,7=20+216,7=20@@=20result=20of=20the=20= @code{cond}-expression.=0A=20@var{key}=20may=20be=20any=20expression,=20= and=20the=20@var{clause}s=20must=20have=20the=20form=0A=20=0A=20@lisp=0A= -((@var{datum1}=20@dots{})=20@var{body}=20@dots{})=0A+((@var{datum1}=20= @dots{})=20@var{body})=0A=20@end=20lisp=0A=20=0A=20or=0A@@=20-229,7=20= +228,7=20@@=20or=0A=20and=20the=20last=20@var{clause}=20may=20have=20the=20= form=0A=20=0A=20@lisp=0A-(else=20@var{expr1}=20@var{body}=20@dots{})=0A= +(else=20@var{body})=0A=20@end=20lisp=0A=20=0A=20or=0A@@=20-241,14=20= +240,13=20@@=20or=0A=20All=20@var{datum}s=20must=20be=20distinct.=20=20= First,=20@var{key}=20is=20evaluated.=20=20The=0A=20result=20of=20this=20= evaluation=20is=20compared=20against=20all=20@var{datum}=20values=0A=20= using=20@code{eqv?}.=20=20When=20this=20comparison=20succeeds,=20the=20= @var{body}=0A-following=20the=20@var{datum}=20is=20evaluated=20like=20= the=20body=20of=20a=20lambda,=0A-returning=20the=20value=20of=20the=20= last=20expression=20as=20the=20result=20of=20the=0A+following=20the=20= @var{datum}=20is=20evaluated=20to=20produce=20the=20result=20of=20the=0A=20= @code{case}=20expression.=0A=20=0A=20If=20the=20@var{key}=20matches=20no=20= @var{datum}=20and=20there=20is=20an=0A=20@code{else}-clause,=20the=20= @var{body}=20following=20the=20@code{else}=20is=0A-evaluated.=20=20If=20= there=20is=20no=20such=20clause,=20the=20result=20of=20the=20expression=20= is=0A-unspecified.=0A+evaluated=20to=20produce=20the=20result=20of=20the=20= @code{case}=20expression.=20=20If=20there=0A+is=20no=20such=20clause,=20= the=20result=20of=20the=20expression=20is=20unspecified.=0A=20=0A=20For=20= the=20@code{=3D>}=20clause=20types,=20@var{expression}=20is=20evaluated=20= and=20the=0A=20resulting=20procedure=20is=20applied=20to=20the=20value=20= of=20@var{key}.=20=20The=20result=20of=0A@@=20-970,13=20+968,12=20@@=20= same=20as=20specified=20by=20SRFI-8=20(@pxref{SRFI-8}).=0A=20= (use-modules=20(ice-9=20receive))=0A=20@end=20lisp=0A=20=0A-@deffn=20= {library=20syntax}=20receive=20formals=20expr=20body=20@dots{}=0A+@deffn=20= {library=20syntax}=20receive=20formals=20expr=20body=0A=20Evaluate=20the=20= expression=20@var{expr},=20and=20bind=20the=20result=20values=20(zero=0A=20= or=20more)=20to=20the=20formal=20arguments=20in=20@var{formals}.=20=20= @var{formals}=20is=20a=0A=20list=20of=20symbols,=20like=20the=20argument=20= list=20in=20a=20@code{lambda}=0A-(@pxref{Lambda}).=20=20After=20binding=20= the=20variables,=20the=20expressions=20in=0A-@var{body}=20@dots{}=20are=20= evaluated=20in=20order,=20the=20return=20value=20is=20the=0A-result=20= from=20the=20last=20expression.=0A+(@pxref{Lambda}).=20=20After=20= binding=20the=20variables,=20the=20@var{body}=20is=0A+evaluated=20to=20= produce=20the=20result=20of=20the=20@code{receive}=20expression.=0A=20=0A= =20For=20example=20getting=20results=20from=20@code{partition}=20in=20= SRFI-1=0A=20(@pxref{SRFI-1}),=0A--=20=0A2.30.2=0A=0A= --Apple-Mail=_3AA9A889-F3FF-4351-AFA5-80BA3D8D9F67--