diff options
| author | Lars Ingebrigtsen | 2021-11-06 20:40:28 +0100 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2021-11-06 21:59:27 +0100 |
| commit | a43ec2e7a33ed7a5d4ff703171bc1c58d0ee0bea (patch) | |
| tree | e8e3965f6509642016470424ea52318f4195a8e3 | |
| parent | 569d7f6a73c939e4f0b9c42cfea95cd3ed5ca8d0 (diff) | |
| download | emacs-a43ec2e7a33ed7a5d4ff703171bc1c58d0ee0bea.tar.gz emacs-a43ec2e7a33ed7a5d4ff703171bc1c58d0ee0bea.zip | |
Add a pcase-let example to the manual
* doc/lispref/control.texi (Destructuring with pcase Patterns):
Add a pcase-let example.
| -rw-r--r-- | doc/lispref/control.texi | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/doc/lispref/control.texi b/doc/lispref/control.texi index 30676f0fb11..06da1025186 100644 --- a/doc/lispref/control.texi +++ b/doc/lispref/control.texi | |||
| @@ -1283,6 +1283,15 @@ bindings that can then be used inside @var{body}. The variable | |||
| 1283 | bindings are produced by destructuring binding of elements of | 1283 | bindings are produced by destructuring binding of elements of |
| 1284 | @var{pattern} to the values of the corresponding elements of the | 1284 | @var{pattern} to the values of the corresponding elements of the |
| 1285 | evaluated @var{exp}. | 1285 | evaluated @var{exp}. |
| 1286 | |||
| 1287 | Here's a trivial example: | ||
| 1288 | |||
| 1289 | @example | ||
| 1290 | (pcase-let ((`(,major ,minor) | ||
| 1291 | (split-string "image/png" "/"))) | ||
| 1292 | minor) | ||
| 1293 | @result{} "png" | ||
| 1294 | @end example | ||
| 1286 | @end defmac | 1295 | @end defmac |
| 1287 | 1296 | ||
| 1288 | @defmac pcase-let* bindings body@dots{} | 1297 | @defmac pcase-let* bindings body@dots{} |