From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Mark H Weaver Newsgroups: gmane.lisp.guile.bugs Subject: bug#30144: [PATCH] doc: Document (ice-9 match) macros. Date: Mon, 19 Mar 2018 20:32:12 -0400 Message-ID: <87zi33bn8z.fsf@netris.org> References: <20180117122504.25583-1-arunisaac@systemreboot.net> <87woyc4qcs.fsf@netris.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1521505929 15124 195.159.176.226 (20 Mar 2018 00:32:09 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 20 Mar 2018 00:32:09 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) Cc: 30144@debbugs.gnu.org To: Arun Isaac Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Tue Mar 20 01:32:04 2018 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ey5C7-0003o3-OC for guile-bugs@m.gmane.org; Tue, 20 Mar 2018 01:32:03 +0100 Original-Received: from localhost ([::1]:44666 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ey5EA-00057J-Md for guile-bugs@m.gmane.org; Mon, 19 Mar 2018 20:34:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45143) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ey5E5-000579-QU for bug-guile@gnu.org; Mon, 19 Mar 2018 20:34:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ey5E2-0000RW-LX for bug-guile@gnu.org; Mon, 19 Mar 2018 20:34:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:34493) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ey5E2-0000RS-Id for bug-guile@gnu.org; Mon, 19 Mar 2018 20:34:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ey5E2-00047G-7P for bug-guile@gnu.org; Mon, 19 Mar 2018 20:34:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Mark H Weaver Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Tue, 20 Mar 2018 00:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 30144 X-GNU-PR-Package: guile X-GNU-PR-Keywords: patch Original-Received: via spool by 30144-submit@debbugs.gnu.org id=B30144.152150599015757 (code B ref 30144); Tue, 20 Mar 2018 00:34:02 +0000 Original-Received: (at 30144) by debbugs.gnu.org; 20 Mar 2018 00:33:10 +0000 Original-Received: from localhost ([127.0.0.1]:42390 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ey5DB-000465-VH for submit@debbugs.gnu.org; Mon, 19 Mar 2018 20:33:10 -0400 Original-Received: from world.peace.net ([50.252.239.5]:33766) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ey5D9-00045Z-09 for 30144@debbugs.gnu.org; Mon, 19 Mar 2018 20:33:08 -0400 Original-Received: from pool-72-93-34-155.bstnma.east.verizon.net ([72.93.34.155] helo=jojen) by world.peace.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1ey5D2-0003jY-Km; Mon, 19 Mar 2018 20:33:00 -0400 In-Reply-To: (Arun Isaac's message of "Sat, 17 Mar 2018 04:57:17 +0530") 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: 208.118.235.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:9030 Archived-At: Hi Arun, Arun Isaac writes: >>> +Match each variable to the corresponding expression, and evaluate the >>> +body with all matched variables in scope. Raise an error if any of the >>> +expressions fail to match. @code{match-let} is analogous to named let >> >> It's only analogous to a named let if a variable name is inserted >> immediately after 'match-let', before the clauses. In fact, the >> named-let case is not covered by the first line of your definition where >> you give the syntax. > >> How about removing any mention of named-let in this definition, and then >> add a separate brief definition for the named-let variant of >> 'match-let'? It might be worthwhile to keep them separate given that >> their use cases and relevant examples are so different. What do you >> think? > > I have made all the other changes except this one. I have never used > match-let analogous to a named let, and am unable to get a working > example. If you could show me a working example, I'll add it to the new > patch. > > I'll send you the revised patch once we decide on the above. Thanks! I thought about it, and I can't easily think of a good use for named 'match-let'. Any recursion needs a base case, which requires at least two cases in the match, but 'match-let' does not allow for multiple cases for its matches. How about if we omit an example for named 'match-let', and simply say something like: @deffn {Scheme Syntax} match-let variable ((pattern init) @dots{}) body Similar to @code{match-let}, but analogously to @dfn{named let}, locally bind VARIABLE to a new procedure which accepts as many arguments as there are INIT expressions. The procedure is initially applied to the results of evaluating the INIT expressions. When called, the procedure matches each argument against the corresponding PATTERN, and returns the result(s) of evaluating the BODY expressions. @xref{while do, Iteration} for more on @dfn{named let}. Thanks! Mark