[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Question on pcase
From: |
Michael Heerdegen |
Subject: |
Re: Question on pcase |
Date: |
Fri, 23 Oct 2015 14:23:24 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) |
Hi Oleh,
I guess you might like something like this:
--8<---------------cut here---------------start------------->8---
(defun pcase-demystify-pattern (pattern)
(pcase--u
`((,(pcase--match '-tested-expression- (pcase--macroexpand pattern))
,(lambda (vars) `(progn ,@(mapcar (lambda (b) `(-bind- ,(car b) ,(cdr b)))
vars)))))))
--8<---------------cut here---------------end--------------->8---
You need to quote the pattern because this is a function.
(pcase-demystify-pattern '`(,_ . ,(and (pred functionp) f)))
==>
(if
(consp -tested-expression-)
(let*
((#1=#:x
(cdr -tested-expression-)))
(if
(functionp #1#)
(progn
(-bind- f #1#))
nil))
nil)
Michael.
- Question on pcase, Oleh Krehel, 2015/10/22
- Re: Question on pcase, Michael Heerdegen, 2015/10/22
- Re: Question on pcase, Eli Zaretskii, 2015/10/23
- Re: Question on pcase, Oleh Krehel, 2015/10/23
- Re: Question on pcase,
Michael Heerdegen <=
- Re: Question on pcase, Oleh Krehel, 2015/10/23
- Re: Question on pcase, Michael Heerdegen, 2015/10/23
- Re: Question on pcase, Oleh Krehel, 2015/10/23
- Re: Question on pcase, Michael Heerdegen, 2015/10/23
- Re: Question on pcase, Johan Bockgård, 2015/10/27
- Re: Question on pcase, Michael Heerdegen, 2015/10/29
- Re: Question on pcase, Michael Heerdegen, 2015/10/23
- Re: Question on pcase, Michael Heerdegen, 2015/10/23
- Re: Question on pcase, Oleh Krehel, 2015/10/23
- Re: Question on pcase, Eli Zaretskii, 2015/10/23