[Top][All Lists]

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

Re: pcase docs

From: Michael Heerdegen
Subject: Re: pcase docs
Date: Fri, 22 Jan 2016 20:58:06 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Michael Heerdegen <address@hidden> writes:

> > All of them?  I guess that means I have more text to write for you.

And pcase-defmacro is intended for developers of (internal) packages
like seq etc, so it must not have to be described broadly.  Just say
that it is basically like `defmacro': you define how to expand the
defined pattern to a new pattern used instead of the one defined.  This
is done recursively (like for defmacro), and when compiling (also
like for defmacro).  It's a simple thing.  A small example could be

You could also make the definition of ` an example.  If you leave out
vectors, it's quite simple and very instructive:

--8<---------------cut here---------------start------------->8---
(pcase-defmacro \` (qpat)
   ((eq (car-safe qpat) '\,) (cadr qpat))
   ((consp qpat)
    `(and (pred consp)
          (app car ,(list '\` (car qpat)))
          (app cdr ,(list '\` (cdr qpat)))))
   ((or (stringp qpat) (integerp qpat) (symbolp qpat)) `',qpat)
   (t (error "Unknown QPAT: %S" qpat))))
--8<---------------cut here---------------end--------------->8---


reply via email to

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