[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: pcase pattern syntax (was: Replace trivial pcase occurrences in the
From: |
Joost Kremers |
Subject: |
Re: pcase pattern syntax (was: Replace trivial pcase occurrences in the Emacs sources) |
Date: |
Fri, 26 Oct 2018 09:16:29 +0200 |
User-agent: |
Mutt/1.9.4 (2018-02-28) |
On Wed, Oct 24, 2018 at 09:03:51AM -0400, Stefan Monnier wrote:
> > (pcase value
> > (`(,_ 1 2)
> > (message "Matched a list of anything followed by (1 2)")))
> >
> > It is not clear to me why I couldn't simply write:
> >
> > (pcase value
> > ((_ 1 2)
> > (message "Matched a list of anything followed by (1 2)")))
>
> The reason is simple: because pcase uses a more verbose pattern syntax.
Perhaps I should have said "not immediately clear".
I've snipped the rest of your reply, not because it's not interesting (it is)
but because I'm really not qualified to argue better pattern matching syntax
with you. I was just trying to answer Richard's question, who was wondering why
people don't seem to use/like pcase as much as one might expect. And since I
had tried a few times in the past to grok pcase but never really got it, I
thought it might be helpful to offer my perspective.
I'm sure that with some practice I could "get" pcase, it's not *that*
difficult. I just find it noticeably more difficult to grok than other Elisp
constructs that are new to me. Usually, it's enough to read the manual to get a
basic idea of how and when to use something. Not so with pcase.
--
Joost Kremers
Life has its moments
- Re: Replace trivial pcase occurrences in the Emacs sources, (continued)
- Re: Replace trivial pcase occurrences in the Emacs sources, Garreau\, Alexandre, 2018/10/27
- Re: Replace trivial pcase occurrences in the Emacs sources, Richard Stallman, 2018/10/24
- Re: Replace trivial pcase occurrences in the Emacs sources, Joost Kremers, 2018/10/24
- Re: Replace trivial pcase occurrences in the Emacs sources, Stefan Monnier, 2018/10/24
- Re: Replace trivial pcase occurrences in the Emacs sources, Daniel Pittman, 2018/10/24
- Re: Replace trivial pcase occurrences in the Emacs sources, Stefan Monnier, 2018/10/24
- pcase pattern syntax (was: Replace trivial pcase occurrences in the Emacs sources), Stefan Monnier, 2018/10/24
- Re: pcase pattern syntax (was: Replace trivial pcase occurrences in the Emacs sources),
Joost Kremers <=
- Re: Replace trivial pcase occurrences in the Emacs sources, João Távora, 2018/10/24
- Re: Replace trivial pcase occurrences in the Emacs sources, Stefan Monnier, 2018/10/24
- Re: Replace trivial pcase occurrences in the Emacs sources, Richard Stallman, 2018/10/24
- Re: Replace trivial pcase occurrences in the Emacs sources, Stefan Monnier, 2018/10/25
- Re: Replace trivial pcase occurrences in the Emacs sources, Andy Moreton, 2018/10/25
- Re: Replace trivial pcase occurrences in the Emacs sources, Stefan Monnier, 2018/10/26
- Re: Replace trivial pcase occurrences in the Emacs sources, Garreau\, Alexandre, 2018/10/26
- Re: Replace trivial pcase occurrences in the Emacs sources, Andy Moreton, 2018/10/27
- Re: Replace trivial pcase occurrences in the Emacs sources, Stefan Monnier, 2018/10/28
- Re: Replace trivial pcase occurrences in the Emacs sources, Alan Mackenzie, 2018/10/29