]> git.eshelyaron.com Git - emacs.git/commitdiff
Add a pcase-let example to the manual
authorLars Ingebrigtsen <larsi@gnus.org>
Sat, 6 Nov 2021 19:40:28 +0000 (20:40 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Sat, 6 Nov 2021 20:59:27 +0000 (21:59 +0100)
* doc/lispref/control.texi (Destructuring with pcase Patterns):
Add a pcase-let example.

doc/lispref/control.texi

index 30676f0fb116134269be3d262ad60633a2152d3f..06da1025186cfc5af0bfa424bc2abc8e716bcd74 100644 (file)
@@ -1283,6 +1283,15 @@ bindings that can then be used inside @var{body}.  The variable
 bindings are produced by destructuring binding of elements of
 @var{pattern} to the values of the corresponding elements of the
 evaluated @var{exp}.
+
+Here's a trivial example:
+
+@example
+(pcase-let ((`(,major ,minor)
+            (split-string "image/png" "/")))
+  minor)
+     @result{} "png"
+@end example
 @end defmac
 
 @defmac pcase-let* bindings body@dots{}