diff options
| author | Michael Heerdegen | 2015-11-03 23:42:24 +0100 |
|---|---|---|
| committer | Michael Heerdegen | 2015-11-03 23:59:42 +0100 |
| commit | 335cb1ee158db47003bda61a6cb077b62d04ca4f (patch) | |
| tree | d4b9184b5c02236f9eb32df62deab5d20cd69aba | |
| parent | 5d1e2fec21dee5d7f81c774e3e30ce8c0c8e5176 (diff) | |
| download | emacs-335cb1ee158db47003bda61a6cb077b62d04ca4f.tar.gz emacs-335cb1ee158db47003bda61a6cb077b62d04ca4f.zip | |
* lisp/emacs-lisp/pcase.el (pcase): Tweak docstring.
| -rw-r--r-- | lisp/emacs-lisp/pcase.el | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el index 8bcb447cfbb..bf6550dfa3d 100644 --- a/lisp/emacs-lisp/pcase.el +++ b/lisp/emacs-lisp/pcase.el | |||
| @@ -107,7 +107,7 @@ | |||
| 107 | 107 | ||
| 108 | ;;;###autoload | 108 | ;;;###autoload |
| 109 | (defmacro pcase (exp &rest cases) | 109 | (defmacro pcase (exp &rest cases) |
| 110 | "Perform ML-style pattern matching on EXP. | 110 | "Eval EXP and perform ML-style pattern matching on that value. |
| 111 | CASES is a list of elements of the form (PATTERN CODE...). | 111 | CASES is a list of elements of the form (PATTERN CODE...). |
| 112 | 112 | ||
| 113 | Patterns can take the following forms: | 113 | Patterns can take the following forms: |
| @@ -115,7 +115,7 @@ Patterns can take the following forms: | |||
| 115 | SYMBOL matches anything and binds it to SYMBOL. | 115 | SYMBOL matches anything and binds it to SYMBOL. |
| 116 | (or PAT...) matches if any of the patterns matches. | 116 | (or PAT...) matches if any of the patterns matches. |
| 117 | (and PAT...) matches if all the patterns match. | 117 | (and PAT...) matches if all the patterns match. |
| 118 | \\='VAL matches if the object is `equal' to VAL | 118 | \\='VAL matches if the object is `equal' to VAL. |
| 119 | ATOM is a shorthand for \\='ATOM. | 119 | ATOM is a shorthand for \\='ATOM. |
| 120 | ATOM can be a keyword, an integer, or a string. | 120 | ATOM can be a keyword, an integer, or a string. |
| 121 | (pred FUN) matches if FUN applied to the object returns non-nil. | 121 | (pred FUN) matches if FUN applied to the object returns non-nil. |
| @@ -131,11 +131,11 @@ FUN can take the form | |||
| 131 | which is the value being matched. | 131 | which is the value being matched. |
| 132 | So a FUN of the form SYMBOL is equivalent to one of the form (FUN). | 132 | So a FUN of the form SYMBOL is equivalent to one of the form (FUN). |
| 133 | FUN can refer to variables bound earlier in the pattern. | 133 | FUN can refer to variables bound earlier in the pattern. |
| 134 | FUN is assumed to be pure, i.e. it can be dropped if its result is not used, | ||
| 135 | and two identical calls can be merged into one. | ||
| 136 | E.g. you can match pairs where the cdr is larger than the car with a pattern | 134 | E.g. you can match pairs where the cdr is larger than the car with a pattern |
| 137 | like \\=`(,a . ,(pred (< a))) or, with more checks: | 135 | like \\=`(,a . ,(pred (< a))) or, with more checks: |
| 138 | \\=`(,(and a (pred numberp)) . ,(and (pred numberp) (pred (< a)))) | 136 | \\=`(,(and a (pred numberp)) . ,(and (pred numberp) (pred (< a)))) |
| 137 | FUN is assumed to be pure, i.e. it can be dropped if its result is not used, | ||
| 138 | and two identical calls can be merged into one. | ||
| 139 | 139 | ||
| 140 | Additional patterns can be defined via `pcase-defmacro'. | 140 | Additional patterns can be defined via `pcase-defmacro'. |
| 141 | Currently, the following patterns are provided this way:" | 141 | Currently, the following patterns are provided this way:" |