unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Richard Stallman <rms@gnu.org>, emacs-devel@gnu.org
Subject: Re: Installing cond* in core
Date: Fri, 2 Feb 2024 15:24:01 +0000	[thread overview]
Message-ID: <Zb0JETlycH9QUbW9@ACM> (raw)
In-Reply-To: <jwvzfwj57to.fsf-monnier+emacs@gnu.org>

Hello, Stefan.

On Fri, Feb 02, 2024 at 08:17:25 -0500, Stefan Monnier wrote:
> >   > I think the question is rather: why should we have two equivalent and
> >   > almost identical matching syntaxes and implementations?
> > That is the easiest way to make cond* function.

> Only if you consider "easiest" at each small incremental step.
> The overall cost of what you've done is already much higher :-)

> > I do not understand the pcase code for implementing pattern matching,

> You don't need to understand it.

I've needed to understand it, and I also found it difficult to
understand.

I've also found difficult the macro expansions which pcase produces.
cond* might be easier here, though it's too soon to tell.

> > A priori, I suspect it won't fit.  cond*-subpat, which does this job
> > in cond*, passes data up and down the recursion.  I can't tell whether
> > pcase does something comparable.  Also, cond*-subpat does not generate
> > the overall structure of a clause -- its caller, cond*-match, does
> > that.

> Throw away cond*-subpat.  Just rewrite

>     (cond*
>      ((match* PAT FORM) THEN)
>      . ELSE)

> into something like

>     (pcase FORM
>       (PAT THEN)
>       (_ (cond* . ELSE)))

> And presumably for

>     (cond*
>      ((match* PAT FORM))
>      . REST)

> you'd rewrite it to

>     (pcase-let ((PATH FORM))
>       (cond* . REST))

> No need to look inside or understand `pcase.el` at all!

But that would rule out the possibility of simplifying pcase by
rewriting it in terms of cond*.  ;-)

>         Stefan

-- 
Alan Mackenzie (Nuremberg, Germany).



  reply	other threads:[~2024-02-02 15:24 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-27 21:36 Installing cond* in core Stefan Kangas
2024-01-27 23:33 ` Alan Mackenzie
2024-01-28  0:26   ` Stefan Kangas
2024-01-28  2:43     ` Po Lu
2024-01-28  6:46       ` Eli Zaretskii
2024-01-28  7:21         ` Po Lu
2024-01-28  7:32           ` Eli Zaretskii
2024-01-28  6:14     ` Eli Zaretskii
2024-01-28 15:58     ` Alan Mackenzie
2024-01-28  6:09   ` Eli Zaretskii
2024-01-28 12:38     ` Alan Mackenzie
2024-01-28 13:02       ` Dmitry Gutov
2024-01-28 13:38         ` Alan Mackenzie
2024-01-28 13:48           ` Dmitry Gutov
2024-01-28 14:32             ` Alan Mackenzie
2024-01-28 16:54               ` Dmitry Gutov
2024-01-28 19:14                 ` Alan Mackenzie
2024-01-28 19:26                   ` Eli Zaretskii
2024-01-28 20:43                   ` Dmitry Gutov
2024-01-30  3:56                 ` Richard Stallman
2024-01-28 13:19       ` Emanuel Berg
2024-01-28 14:18       ` Eli Zaretskii
2024-01-28 15:26         ` Alan Mackenzie
2024-01-28 15:40           ` Eli Zaretskii
2024-01-30  3:57             ` Richard Stallman
2024-01-28  4:28 ` Stefan Monnier via Emacs development discussions.
2024-01-30  3:58   ` Richard Stallman
2024-01-30 14:33     ` Stefan Monnier
2024-02-02  3:39       ` Richard Stallman
2024-02-02 13:17         ` Stefan Monnier
2024-02-02 15:24           ` Alan Mackenzie [this message]
2024-02-02 18:50             ` Stefan Monnier
2024-02-04  4:47               ` Richard Stallman
2024-02-04 14:12                 ` Stefan Monnier
2024-02-06  3:49                   ` Richard Stallman
2024-02-05  3:33           ` Richard Stallman
2024-02-05 12:39             ` Stefan Monnier
2024-03-13  2:27               ` Richard Stallman
2024-03-13  3:05                 ` Stefan Monnier
2024-03-16  1:45                   ` Richard Stallman
2024-03-16 16:15                     ` Stefan Monnier
2024-03-18  2:42                       ` Richard Stallman
2024-03-18  3:06                         ` Stefan Monnier
2024-03-19  9:19                           ` Peter Hull
2024-03-20 22:40                           ` Richard Stallman
2024-03-20 22:54                             ` Stefan Monnier
2024-01-28 14:28 ` Emanuel Berg
2024-01-30  3:58 ` Richard Stallman
2024-01-30 13:04   ` Eli Zaretskii
2024-03-16 20:53 ` Lynn Winebarger
2024-03-18  2:41   ` Richard Stallman
2024-03-19 19:48     ` Lynn Winebarger

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/emacs/

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

  git send-email \
    --in-reply-to=Zb0JETlycH9QUbW9@ACM \
    --to=acm@muc.de \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=rms@gnu.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).