GNU bug report logs - #13126
24.3.50; (WISH) Document pcase in Info manual

Previous Next

Package: emacs;

Reported by: Jambunathan K <kjambunathan <at> gmail.com>

Date: Sun, 9 Dec 2012 09:27:01 UTC

Severity: minor

Merged with 12752

Found in version 24.3.50

Fixed in version 24.3

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Jambunathan K <kjambunathan <at> gmail.com>
Cc: 13126 <at> debbugs.gnu.org
Subject: bug#13126: 24.3.50; (WISH) Document pcase in Info manual
Date: Tue, 11 Dec 2012 08:55:34 -0500
> Thanks.  `pcase' seemed a good replacement for `case'.

While it's not a plug-in replacement, it provides a superset of the
features of case, yes.

> 1. pcase-let, pcase-let*, pcase-dolist (maybe)

pcase-dolist shouldn't be documented (yet?).  Maybe pcase-let and
pcase-let* should be there, indeed.

> 2. It took some effort to understand that there is a U-PATTERN and a
>    UPATTERN.  We don't read out `*-*', do we?
>     ,----
>     |    There are two kinds of patterns involved in `pcase', called
>     | _U-patterns_ and _Q-patterns_.  The UPATTERN mentioned above are
>     | U-patterns and can take the following forms:
>     `----

What do you suggest instead?

> 3. Let's take the example of how
>     ,----
>     | (defun evaluate (exp env)
>     |   (pcase exp
>     | ,----
>     | |     (`(add ,x ,y)         (+ (evaluate x env) (evaluate y env)))
>     | `----
>     |     (`(call ,fun ,arg)    (funcall (evaluate fun) (evaluate arg env)))
>     |     (`(fn ,arg ,body)     (lambda (val)
>     |                             (evaluate body (cons (cons arg val) env))))
>     |     ((pred numberp)       exp)
>     |     ((pred symbolp)       (cdr (assq exp env)))
>     |     (_                    (error "Unknown expression %S" exp))))
>     `----
>              `(add ,x ,y)
>         `   QPATTERN

I don't know what you wanted to say here.


        Stefan




This bug report was last modified 12 years and 112 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.