all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Earl Hyatt via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 47261@debbugs.gnu.org
Subject: bug#47261: Fwd: bug#47261: Destructuring with Pcase without assigning values
Date: Mon, 19 Apr 2021 22:06:51 +0000	[thread overview]
Message-ID: <42f78acc-b2f3-9bfd-8891-d316b7a95e1c@protonmail.com> (raw)
In-Reply-To: <1dacded9-3e40-bc02-56c7-a157d739ffb7@protonmail.com>


For the record, I am forwarding this reply to the bug tracker. I forgot
to send the original message to the tracker.

-------- Forwarded Message --------
Subject: Re: bug#47261: Destructuring with Pcase without assigning values
Date: Sat, 17 Apr 2021 18:50:10 -0400
From: Okam <okamsn@protonmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>

On 4/16/21 11:22 PM, Stefan Monnier wrote:
>
>>> The `pcase` macro itself uses this function, so it should hopefully be
>>> "good enough", but let me know if it's causing you trouble.
>> This seems to work well for my use case. Thank you for making this change.
>
> You're welcome.  It was actually a good change for the code's
> readability as well.
>
>> Are the variables always given in the order that they appear in the
>> pattern?
>
> I don't know.  Why? >
>> If not, is finding elements of the form "(\, SYMBOL)" enough to
>> identify variables in a Pcase pattern?
>
> No.  , is not even one of the core pcase patterns, it's only something
> used within the ` pattern (which is not a core pattern either; it is
> defined via `pcase-defmacro`).
>
>
>          Stefan
>

In the `cl-loop`-like macro that I am writing, things are currently set
up so that variables being assigned values in accumulation clauses can
be automatically used as the return value of the macro.

      ;; => ((1 3 5) (2 4 6))
      (loopy (flag pcase)
             (list i '((1 2) (3 4) (5 6)))
             (collect `(,a ,b) i))

This behavior requires finding the variables in the correct order.

The getting of the variables used ("a" and "b" above) can be done when
using the new `pcase-compile-pattern`, if the variables are fed to the
CODEGEN argument in the order that they are written, or I can try to
find them manually, if possible.

If neither are possible, then I will just remove this behavior.

Thank you.






  parent reply	other threads:[~2021-04-19 22:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-19 13:47 bug#47261: Destructuring with Pcase without assigning values Okam via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-19 21:45 ` Stefan Monnier
2021-04-17  1:24   ` Okam via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-04-17  3:22     ` Stefan Monnier
     [not found]       ` <1dacded9-3e40-bc02-56c7-a157d739ffb7@protonmail.com>
2021-04-19 22:06         ` Earl Hyatt via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
     [not found]         ` <jwveef84hcl.fsf-monnier+emacs@gnu.org>
     [not found]           ` <4925d1a5-4669-8290-e534-1662f13ca183@protonmail.com>
2021-04-19 22:10             ` bug#47261: Fwd: " Okam via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-24 18:36   ` Lars Ingebrigtsen

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

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

  git send-email \
    --in-reply-to=42f78acc-b2f3-9bfd-8891-d316b7a95e1c@protonmail.com \
    --to=bug-gnu-emacs@gnu.org \
    --cc=47261@debbugs.gnu.org \
    --cc=earl.hyatt@protonmail.com \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.