emacs-devel
[Top][All Lists]
Advanced

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

Re: pcase ` meaning [Was: Re: Replace trivial pcase occurrences in the E


From: Clément Pit-Claudel
Subject: Re: pcase ` meaning [Was: Re: Replace trivial pcase occurrences in the Emacs sources]
Date: Mon, 29 Oct 2018 13:26:13 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1

On 28/10/2018 19.09, Garreau, Alexandre wrote:
> the pattern look like what the data should be. adding “`” and “,”
> destroy this feature, because the pattern no longer looks like what
> is matched.

Maybe it's a matter of perspective? Adding "`" and "," is precisely what makes 
the pattern look like the data: the invariant is that if you have a match, 
repeating the pattern produces the original data.

Here's a concrete example: (pcase '(1 2 3 4) (`(,x ,y . ,z) `(,x ,y . ,z))) is 
a no-op.
In other words, q-patterns are equations with multiple unknown variables 
(holes).  When you write a q-pattern, you're asking "what values should the 
variables in this pattern take so that evaluating the pattern would return the 
matched data?"

Clément.



reply via email to

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