[Top][All Lists]

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

Re: pcase ` meaning

From: Garreau\, Alexandre
Subject: Re: pcase ` meaning
Date: Thu, 01 Nov 2018 15:11:10 +0100
User-agent: Gnus (5.13), GNU Emacs 25.1.1 (i686-pc-linux-gnu, GTK+ Version 3.22.11) of 2017-09-15, modified by Debian

On 2018-11-01 at 09:22, Clément Pit-Claudel wrote:
> On 31/10/2018 19.13, Garreau, Alexandre wrote:
>> In lisp I would have prefered to be able to directly quote each symbol,
>> and have this to work, eg: “(pcase (list 1 2 3) (('a 'b 'c) t))” to
>> return nil, and “(pcase (list 'a 'b 'c) (('a 'b 'c) t))” to return t
>> (and this is like many other lisp pattern-matching implementations
>> already work).  In current pcase, pattern “(a b c)” does *not* mean
>> “with symbols 'a, 'b and 'c”.
> But remember that this breaks the pattern-body symmetry:  
>   (pcase (list 'a 'b 'c) (('a 'b 'c) ('a 'b 'c)))
> would match, but the body would raise an error.

Then if it’s important to you, don’t do that, it’s a question of tastes
and style.  Other implementations allow to do that.

You may as well quote the list, or, better imho, use a list constructor
(list 'a 'b 'c) as a pattern.  Which also exists in other

reply via email to

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