[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#14935: 24.3.50; pcase (or) UPAT fails?
From: |
Vitalie Spinu |
Subject: |
bug#14935: 24.3.50; pcase (or) UPAT fails? |
Date: |
Tue, 23 Jul 2013 23:00:16 +0200 |
User-agent: |
Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50 (gnu/linux) |
Thanks Andreas and Stephen,
I actually tried unquoting with comma before reporting. But it never
occurred to me that strings should be backticked. Strings are selfquoted
and, in my understanding, the following should have worked:
(pcase "^"
((or "^" "%") (message "here")))
The documentation says that strings are UPATs so
(pcase "^"
("^" (message "here")))
works. Then docs also say that (or UPAT UPAT) is also an UPAT so (or "^"
"%") should also work. Do I miss anything?
Thanks,
Vitalie
>> Stefan Monnier <monnier@iro.umontreal.ca>
>> on Tue, 23 Jul 2013 09:44:49 -0400 wrote:
>> This doesn't:
>> (pcase (list 23 nil "%")
>> (`(,scale nil (or "^" "%")) (message "%s" scale))
>> (_ (message "failed")))
>> Is this a bug?
> No, it's normal. The third pattern matches a list of 3 elements (the
> first being the symbol `or'). You probably meant to do
> (pcase (list 23 nil "%")
> (`(,scale nil ,(or `"^" `"%")) (message "%s" scale))
> (_ (message "failed")))
> -- Stefan