I'm trying to get pcase
to match against a let
-bound variable. However, I can't seem to get pcase
to recognize the variable correctly.
See this minimal example:
(let ((a 1)) (pcase 2 (a 7))) => 7 ;; as predicted by the docs
(let ((a 2)) (pcase 2 (`a 7))) => nil ;; ???
How can I get pcase
to return 7
iff a = 2
?
(An alternative to pcase
with similar features would also suffice.)
(pred ...)
would work (although it would be clumsy, but even(let ((a 2)) (pcase 2 (`(pred (lambda (x) (= x a))) 7)))
doesn't seem to work. – PythonNut Jan 29 '16 at 18:28(let ((a 2)) (pcase 2 ((pred (equal a)) 7)))
? – Constantine Jan 29 '16 at 18:31pcase
doesn't seem to care. – PythonNut Jan 29 '16 at 19:49