[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How other pattern-matching lisps do [Was: Re: pcase ` meaning [Was:
From: |
Garreau\, Alexandre |
Subject: |
Re: How other pattern-matching lisps do [Was: Re: pcase ` meaning [Was: Re: Replace trivial pcase occurrences in the Emacs sources]] |
Date: |
Sun, 28 Oct 2018 18:57:25 +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-10-28 at 09:44, Stefan Monnier wrote:
>> Okay, so I went to search what is done in other pattern matching lisp
>> form.
>
> You missed Racket's `match`
> (https://docs.racket-lang.org/reference/match.html)
Indeed! Thank you! I missed it because when reading guile reference
(incidentelly already installed on my system, while I don’t even know if
racket’s is installable as info, pdf, man or even html here), I naively
thought if it said most schemes used the same, racket would too.
And indeed, it seems pretty compatible, beside being interestingly way
richer, having the `list', `vector', etc. patterns I found in cl-match…
and I’m very happy the `var' I made out of “Lisp, 3rd ed” book annex I
found happen to be just the same, compatible with racket: this easily
paliates for binding all constructs which aren’t bindable in guile’s
match (“((var list) foo)” to bind the symbol “list” as a first element).
> Incidentally, I also missed it when I did the same search you did before
> embarking on the design and implementation of pcase. I later found
> Racket's `match` which was pretty close to the original design of pcase,
> but showed me how to add `pcase-defmacro` (mostly by adding the `app`
> pattern), which led to the "new pcase" where ` is a macro (and where
> ' was added for that macro to have something to expand to).
What was is initially? non-existing?
> The current `pcase` is pretty close to Racket's `match`. The main
> missing functionality is the negation,
In terms of powerfulness, however, to come back to original discussion:
confusion. The presence of type constructors (`list', `array'), the
fact lists and arrays, otherwise (if not matching a defined pattern)
work out of the box, and the `var' form, allow, if needed, to completely
avoid the “`” syntax. And to me it’s like it appear that this syntax is
confusing quite some people (and I understand why, except when in ,(foo)
`foo' is a defined pattern, so it’s look like a function call). So
avoiding this syntax in source code could be handy so to give a better
image to pcase, which would understood more easily.
> which Racket solves "easily" because its underlying language handles
> lambda much more efficiently (i.e. the code generated by `match` would
> work very poorly in Elisp unless we significantly improved the
> byte-compiler's handling of funcall).
>From what I feel sometimes scheme’s byte-compiler are pretty handy,
maybe less than some cl compilers, but… well maybe it is only that elisp
byte-compiler doesn’t do that much, does it?
- Re: Replace trivial pcase occurrences in the Emacs sources, (continued)
- Re: Replace trivial pcase occurrences in the Emacs sources, Eli Zaretskii, 2018/10/24
- Re: Replace trivial pcase occurrences in the Emacs sources, Garreau\, Alexandre, 2018/10/24
- 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
- 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 <=
- 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, 2018/10/28
- 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