[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: pcase-dolist
From: |
Artur Malabarba |
Subject: |
Re: pcase-dolist |
Date: |
Wed, 8 Jul 2015 20:44:17 +0100 |
>> > Anyway, an idea that came to my mind more than once: `when-let',
>> > `if-let' should really be `pcase-when-let' , `pcase-if-let'. They
>> > would be much more useful than the plain versions I think.
>>
>> Yes, feel free to change them that way.
>
> Though, just changing them would break existing code (the current
> versions are about boolean values, the pcase versions would be about
> pattern matching).
>
> For example, now
>
> (if-let ((a (ignore))) a 17) ==> 17,
>
> but
>
> (pcase-if-let ((a (ignore))) a 17) ==> nil.
Only if you make them like this. The idea of `(if-let ((a expr))
body)' is that evaluate `expr' and, if it is non-nil, bind it to a and
run `body'. This doesn't exclude the possibility of `a' being a pcase
pattern. Just make sure that the the check for nil expr is done as a
separate thing, before the pattern matching.
If you implement pcase-if-let the way you suggest above, isn't that
just the same as pcase?
- Re: pcase-dolist, (continued)
- Re: pcase-dolist, Thierry Volpiatto, 2015/07/09
- Re: pcase-dolist, Tassilo Horn, 2015/07/09
- Re: pcase-dolist, Thierry Volpiatto, 2015/07/09
- Re: pcase-dolist, Tassilo Horn, 2015/07/09
- Re: pcase-dolist, Thierry Volpiatto, 2015/07/09
- Re: pcase-dolist, Stefan Monnier, 2015/07/09
- Re: pcase-dolist, Michael Heerdegen, 2015/07/09
- Re: pcase-dolist, Stefan Monnier, 2015/07/10
- Re: pcase-dolist, Tassilo Horn, 2015/07/10
- Re: pcase-dolist, Stefan Monnier, 2015/07/10
- Re: pcase-dolist,
Artur Malabarba <=
- Re: pcase-dolist, Michael Heerdegen, 2015/07/08