[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Question on pcase
From: |
Oleh Krehel |
Subject: |
Re: Question on pcase |
Date: |
Fri, 23 Oct 2015 14:42:20 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) |
Michael Heerdegen <address@hidden> writes:
> I guess you might like something like this:
>
> (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)))))))
>
> 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)
Thanks Michael, that's almost exactly what I need. The only thing is
that I don't understand what `-bind-' is.
- 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, 2015/10/23
- Re: Question on pcase,
Oleh Krehel <=
- 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
- Re: Question on pcase, Michael Heerdegen, 2015/10/23