[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: The poor state of documentation of pcase like things.
From: |
Phillip Lord |
Subject: |
Re: The poor state of documentation of pcase like things. |
Date: |
Sat, 19 Dec 2015 19:23:44 +0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Michael Heerdegen <address@hidden> writes:
> address@hidden (Phillip Lord) writes:
>
>> (pcase '(3 1 2)
>> (`(_ 1 2)
>> (message "Matched a list of anything followed by (2 3)")))
>>
>> prints nothing.
>>
>> while this...
>>
>> (pcase '(3 1 2)
>> (`(,_ 1 2)
>> (message "Matched a list of anything followed by (2 3)")))
>>
>> prints the message (which should be "followed by (2 3)").
>>
>> I am a bit surprised to find that _ needs , in these examples, and I
>> think that it's a bug.
>
> I think it's intentional, and it fits the documentation.
Not convinced. The documentation says....
‘(pred numberp)’ is a pattern that simply checks that ‘exp’ is a number,
and ‘_’ is the catch-all pattern that matches anything.
for example, which made me assume that "_" matches anything.
> We think of elements in a backquoted list to be all quoted unless
> explicitly unquoted. It makes no sense that '_ matches any expression.
> It matches only the symbol _, and that can be useful, too.
To be it seems unintuitive, to be honest. It took me a while to work
this out; John made the same mistake, it seems.
Phil
Re: The poor state of documentation of pcase like things., John Wiegley, 2015/12/17
- Re: The poor state of documentation of pcase like things., Richard Stallman, 2015/12/17
- Re: The poor state of documentation of pcase like things., Phillip Lord, 2015/12/18
- Re: The poor state of documentation of pcase like things., Michael Heerdegen, 2015/12/19
- Re: The poor state of documentation of pcase like things.,
Phillip Lord <=
- Re: The poor state of documentation of pcase like things., Michael Heerdegen, 2015/12/19
- Re: The poor state of documentation of pcase like things., Phillip Lord, 2015/12/19
- Re: The poor state of documentation of pcase like things., Richard Stallman, 2015/12/20
- RE: The poor state of documentation of pcase like things., Phillip Lord, 2015/12/20
- Re: The poor state of documentation of pcase like things., Richard Stallman, 2015/12/21
- Re: The poor state of documentation of pcase like things., Phillip Lord, 2015/12/21
- Re: The poor state of documentation of pcase like things., John Wiegley, 2015/12/22
Re: The poor state of documentation of pcase like things., Michael Heerdegen, 2015/12/20
Re: The poor state of documentation of pcase like things., Michael Heerdegen, 2015/12/20
Re: The poor state of documentation of pcase like things., Phillip Lord, 2015/12/20