help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: pcase and minus-sign


From: Andreas Röhler
Subject: Re: pcase and minus-sign
Date: Sat, 3 Dec 2016 09:04:02 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:45.0) Gecko/20100101 Icedove/45.4.0



On 02.12.2016 03:30, Stefan Monnier wrote:
But what make the char `a' so special WRT char `1'?:

(defun foo (arg)
(interactive "P")
(pcase arg
(1 (message "%s" "ARG was `1'"))
(a (message "%s" "ARG was `a'"))
('- (message "%s" "ARG was minus-sign"))
(_ (message "%s" "ARG not minus-sign"))))
The same thing that makes it different in "normal" Lisp code. 1 is read as
an integer, not as a symbol.
Thanks all again!
BTW, the driving idea behind the shape of pcase patterns is more or less
that a pattern PAT matches the value V if an expression PAT could
evaluate to the value V.

Must confess some hardship of understanding. If an expression may evaluate to a certain value or not, that depends resp. may depend on the state at run-time. Can't see how that makes sense here.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]