Document pcase-lambda
* doc/lispref/control.texi (Destructuring with pcase Patterns): Document pcase-lambda (bug#20268).
This commit is contained in:
parent
d97e9d701d
commit
a512940daa
1 changed files with 14 additions and 0 deletions
|
@ -1326,6 +1326,20 @@ Assign values to variables in a @code{setq} form, destructuring each
|
|||
@var{value} according to its respective @var{pattern}.
|
||||
@end defmac
|
||||
|
||||
@defmac pcase-lambda lambda-list &rest body
|
||||
This is like @code{lambda}, but allows each argument to be a pattern.
|
||||
For instance, here's a simple function that takes a cons cell as the
|
||||
argument:
|
||||
|
||||
@example
|
||||
(setq fun
|
||||
(pcase-lambda (`(,key . ,val))
|
||||
(vector key (* val 10))))
|
||||
(funcall fun '(foo . 2))
|
||||
@result{} [foo 20]
|
||||
@end example
|
||||
@end defmac
|
||||
|
||||
@node Iteration
|
||||
@section Iteration
|
||||
@cindex iteration
|
||||
|
|
Loading…
Add table
Reference in a new issue