[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] pcase.el: Add type pattern
From: |
Eric Abrahamsen |
Subject: |
Re: [PATCH] pcase.el: Add type pattern |
Date: |
Tue, 10 Mar 2020 12:10:05 -0700 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Adam Porter <address@hidden> writes:
> Hi Michael,
>
> Adam Porter <address@hidden> writes:
>
>>>> 1. Run emacs -Q.
>>>> 2. Evaluate this form in *scratch*:
>>>>
>>>> (pcase-defmacro type (type)
>>>> "Pcase pattern that matches objects of TYPE.
>>>> TYPE is a symbol or list as accepted by `cl-typep', which see."
>>>> `(pred (pcase--flip cl-typep ',type)))
>>>>
>>>> 3. Evaluate this form in *scratch*:
>>>>
>>>> (macroexpand-all '(pcase 10 ((type (integer 0 10)) t)))
>>>>
>>>> Result:
>>>>
>>>> (if (and (integerp 10) (>= 10 (quote 0)) (<= 10 (quote 10))) (progn t)
>>>> nil)
>>>
>>> No, I don't see that here. I'm using current master here.
>>
>> Hm, I don't know how to explain that. I guess I'll have to rebuild
>> master and check again.
>
> Here are the steps I just followed:
>
> 1. Pull master and rebase my patch on it.
> 2. ./configure && make && src/emacs -Q.
> 3. Evaluate this expression, in both *scratch* and M-:, which give the
> same result:
>
> (macroexpand-all '(pcase 10 ((type (integer 0 10)) t)))
>
> Result:
>
> (if (and (integerp 10) (>= 10 '0) (<= 10 '10)) (progn t) nil)
>
> I can't explain why you get a different result.
FWIW, I get the same. `if' when there's only one branch, `cond' when
there's more.
- Re: [PATCH] pcase.el: Add type pattern, (continued)
- Re: [PATCH] pcase.el: Add type pattern, Michael Heerdegen, 2020/03/10
- Re: [PATCH] pcase.el: Add type pattern, Michael Heerdegen, 2020/03/10
- Re: [PATCH] pcase.el: Add type pattern, Adam Porter, 2020/03/10
- Re: [PATCH] pcase.el: Add type pattern, Michael Heerdegen, 2020/03/10
- Re: [PATCH] pcase.el: Add type pattern, Adam Porter, 2020/03/10
- Re: [PATCH] pcase.el: Add type pattern, Michael Heerdegen, 2020/03/10
- Re: [PATCH] pcase.el: Add type pattern, Adam Porter, 2020/03/10
- Re: [PATCH] pcase.el: Add type pattern, Adam Porter, 2020/03/10
- Re: [PATCH] pcase.el: Add type pattern, Michael Heerdegen, 2020/03/10
- Re: [PATCH] pcase.el: Add type pattern, Adam Porter, 2020/03/10
- Re: [PATCH] pcase.el: Add type pattern,
Eric Abrahamsen <=
- Re: [PATCH] pcase.el: Add type pattern, Adam Porter, 2020/03/10
- Re: [PATCH] pcase.el: Add type pattern, Michael Heerdegen, 2020/03/10
- Re: [PATCH] pcase.el: Add type pattern, Stefan Monnier, 2020/03/16