[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#13126: 24.3.50; (WISH) Document pcase in Info manual
From: |
Jambunathan K |
Subject: |
bug#13126: 24.3.50; (WISH) Document pcase in Info manual |
Date: |
Tue, 11 Dec 2012 15:50:42 +0530 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
>> 24.3.50; Document pcase in Info manual
>
> I just installed a doc for it in the `emacs-24' branch. Please take
> a look at it,
Thanks. `pcase' seemed a good replacement for `case'.
Quick feedback.
1. pcase-let, pcase-let*, pcase-dolist (maybe)
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:
`----
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