emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: pcase bindings in patterns with complicated logic


From: Stefan Monnier
Subject: Re: pcase bindings in patterns with complicated logic
Date: Tue, 23 Jan 2024 14:59:54 -0500
User-agent: Gnus/5.13 (Gnus v5.13)

> The `app` pattern is mostly for internal use when defining other
> patterns.  It's key to the implementation of patterns like backquote so
> it's very important, but you'll rarely see it "out and about" in
> a `pcase` or `pcase-let` statement.

BTW, if you want help to understand the general design of Pcase, a good
read is that of the design of `match` for Racket:

    Extensible Pattern Matching in an Extensible Language
    Sam Tobin-Hochstadt, 2010
    https://arxiv.org/abs/1106.2578

I didn't know about that `match` construct when I started Pcase (and now
that I actually pay attention to the publication date I realize that
maybe it's not because I missed it in my searches but because it came
out around the same time), but when I found it, I "realigned" Pcase to
be more like Racket's `match`.  The implementation is not quite the same
because sadly our ELisp implementation doesn't handle (tail) calls quite
as efficiently as Racket, but there's a large overlap when it comes to
the exposed functionality.


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]