[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: |
Michael Heerdegen |
Subject: |
Re: pcase ` meaning [Was: Re: Replace trivial pcase occurrences in the Emacs sources] |
Date: |
Mon, 29 Oct 2018 00:57:51 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
"Garreau, Alexandre" <address@hidden> writes:
> “(var name)”, as does racket and some common-lisp match/unify
> implementations. And so to integrate with “`”: “,(var name)” doesn’t
> disturb me, it is okay: will bind “name” to something, pretty
> straightforward.
That would make totally sense to me. I often found it confusing that
using a symbol which is already bound (outside of pcase) isn't turned
into an equality test. Having an explicit `var' or `bind' for binding
variables would be nice.
> Beside lisp, all pattern matching language make their feature serve
> one purpose: the pattern look like what the data should be. adding “`”
> and “,” destroy this feature, because the pattern no longer looks like
> what is matched.
But with, for example, el-search, that suddenly looks very natural if
you can, for example, transpose the first two arguments of all `foo'
calls in your code with the rule.
`(foo ,a ,b . ,rest) -> `(foo ,b ,a . ,rest)
The pattern exactly looks like the matched data! Just with a different
point of view. Using ``' is not what most people would naively use to
implement destructuring, but I don't find it unnatural or not intuitive,
no.
The above pattern would look different if we would have to write it as
`(foo ,(var a) ,(var b) . ,(var rest))
so the implicit binding feature of symbols also makes patterns much more
readable in more complex cases, which is a big win.
Michael.
- Re: Replace trivial pcase occurrences in the Emacs sources, (continued)
- Re: Replace trivial pcase occurrences in the Emacs sources, Dmitry Gutov, 2018/10/27
- Re: Replace trivial pcase occurrences in the Emacs sources, Michael Heerdegen, 2018/10/27
- Re: Replace trivial pcase occurrences in the Emacs sources, Garreau\, Alexandre, 2018/10/27
- pcase ` meaning [Was: Re: Replace trivial pcase occurrences in the Emacs sources], Garreau\, Alexandre, 2018/10/27
- How other pattern-matching lisps do [Was: Re: pcase ` meaning [Was: Re: Replace trivial pcase occurrences in the Emacs sources]], Garreau\, Alexandre, 2018/10/28
- Re: How other pattern-matching lisps do [Was: Re: pcase ` meaning [Was: Re: Replace trivial pcase occurrences in the Emacs sources]], Stefan Monnier, 2018/10/28
- Re: How other pattern-matching lisps do [Was: Re: pcase ` meaning [Was: Re: Replace trivial pcase occurrences in the Emacs sources]], Garreau\, Alexandre, 2018/10/28
- Re: How other pattern-matching lisps do [Was: Re: pcase ` meaning [Was: Re: Replace trivial pcase occurrences in the Emacs sources]], Michael Heerdegen, 2018/10/28
- Re: pcase ` meaning [Was: Re: Replace trivial pcase occurrences in the Emacs sources], Michael Heerdegen, 2018/10/28
- Re: pcase ` meaning [Was: Re: Replace trivial pcase occurrences in the Emacs sources], Garreau\, Alexandre, 2018/10/28
- Re: pcase ` meaning [Was: Re: Replace trivial pcase occurrences in the Emacs sources],
Michael Heerdegen <=
- Re: pcase ` meaning [Was: Re: Replace trivial pcase occurrences in the Emacs sources], Garreau\, Alexandre, 2018/10/29
- Re: pcase ` meaning [Was: Re: Replace trivial pcase occurrences in the Emacs sources], Michael Heerdegen, 2018/10/29
- Re: pcase ` meaning, Garreau\, Alexandre, 2018/10/29
- Re: pcase ` meaning, Michael Heerdegen, 2018/10/29
- Re: pcase ` meaning, Garreau\, Alexandre, 2018/10/29
- Re: pcase ` meaning, Michael Heerdegen, 2018/10/29
- Re: pcase ` meaning, Yuri Khan, 2018/10/30
- Re: pcase ` meaning [Was: Re: Replace trivial pcase occurrences in the Emacs sources], Clément Pit-Claudel, 2018/10/29
- Re: pcase ` meaning, Garreau\, Alexandre, 2018/10/29
- Re: pcase ` meaning, Stefan Monnier, 2018/10/30