* lisp/emacs-lisp/pcase.el: Add support for not
to pred
(pcase--split-pred, pcase--funcall): Adjust for `not`. (pcase--get-macroexpander): New function. (pcase--edebug-match-macro, pcase--make-docstring) (pcase--macroexpand): Use it. * lisp/emacs-lisp/radix-tree.el (radix-tree-leaf): Use it! * doc/lispref/control.texi (The @code{pcase} macro): Document it. * lisp/emacs-lisp/ert.el (ert--explain-equal-rec): Remove redundant test.
This commit is contained in:
parent
df34ed8cbf
commit
0ab56a4e93
6 changed files with 56 additions and 16 deletions
|
@ -198,9 +198,10 @@ If not found, return nil."
|
|||
(pcase-defmacro radix-tree-leaf (vpat)
|
||||
"Pattern which matches a radix-tree leaf.
|
||||
The pattern VPAT is matched against the leaf's carried value."
|
||||
;; FIXME: We'd like to use a negative pattern (not consp), but pcase
|
||||
;; doesn't support it. Using `atom' works but generates sub-optimal code.
|
||||
`(or `(t . ,,vpat) (and (pred atom) ,vpat))))
|
||||
;; We used to use `(pred atom)', but `pcase' doesn't understand that
|
||||
;; `atom' is equivalent to the negation of `consp' and hence generates
|
||||
;; suboptimal code.
|
||||
`(or `(t . ,,vpat) (and (pred (not consp)) ,vpat))))
|
||||
|
||||
(defun radix-tree-iter-subtrees (tree fun)
|
||||
"Apply FUN to every immediate subtree of radix TREE.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue