unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Mark H Weaver <mhw@netris.org>
To: Arun Isaac <arunisaac@systemreboot.net>
Cc: 30144@debbugs.gnu.org
Subject: bug#30144: [PATCH] doc: Document (ice-9 match) macros.
Date: Mon, 19 Mar 2018 20:32:12 -0400	[thread overview]
Message-ID: <87zi33bn8z.fsf@netris.org> (raw)
In-Reply-To: <cu7lgerfvoq.fsf@systemreboot.net> (Arun Isaac's message of "Sat,  17 Mar 2018 04:57:17 +0530")

Hi Arun,

Arun Isaac <arunisaac@systemreboot.net> 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





  reply	other threads:[~2018-03-20  0:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-17 12:25 bug#30144: [PATCH] doc: Document (ice-9 match) macros Arun Isaac
2018-01-21 16:16 ` Mark H Weaver
2018-01-21 18:14   ` Arun Isaac
2018-02-21 22:22   ` Ludovic Courtès
2018-03-16  4:05 ` Mark H Weaver
2018-03-16  4:33   ` Mark H Weaver
2018-03-16 23:27   ` Arun Isaac
2018-03-20  0:32     ` Mark H Weaver [this message]
2018-03-23 14:22 ` bug#30144: [PATCH 0/1] " Arun Isaac
2018-03-23 14:22   ` bug#30144: [PATCH 1/1] doc: " Arun Isaac
2018-06-18 12:08     ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zi33bn8z.fsf@netris.org \
    --to=mhw@netris.org \
    --cc=30144@debbugs.gnu.org \
    --cc=arunisaac@systemreboot.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).