Subject: bug#67611: [PATCH] Add a Pcase pattern `cl-lambda` equivalent to `cl-destructuring-bind`

From: João Távora <[email-masked]>
Date: Tue, 5 Dec 2023 09:26:58 +0000

On Tue, Dec 5, 2023 at 2:43 AM Okamsn via Bug reports for GNU Emacs,
the Swiss army knife of text editors <[email-masked]> wrote:

> For me, I am interested in using such a destructuring pattern with
> `pcase-let` and `pcase-setq`, but not so much with `pcase` itself.
>
> > Maybe we could introduce a different Pcase pattern which covers those
> > needs but stays closer to the Pcase pattern syntax?
>
> As far as I understand Pcase, one thing that I think cl-lib does better
> is specifying default values for multiple optional variables. For
> example, for `(a &optional (b 2) (c 3))` in Pcase, I would write

Yes.  cl-lib has a couple of neat tricks up its sleeve, still.

And what about keyword arguments in plists? Can pcase
destructure them?  If so, does it bind the "supplied-p" variable?
And can it rename the variable being destructured to something
else non-clashing?

All these things are useful in CL's destructuring-bind,
but it is missing other stuff like "casing" logic.  So
at least on a first glimpse, this reunion would be
welcome by me.

With the caveat that I haven't seen any examples or the
patch yet, and it matters.

João