aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTassilo Horn2013-12-25 10:12:24 +0100
committerTassilo Horn2013-12-25 10:12:24 +0100
commitff1c842a9477dee39fa20f885d64288b4947a040 (patch)
tree36261c735781ece4dc7cb04ee4b9577cf618657e
parent362397edd9f48bf431c8ea4ca2a88d15c5660bde (diff)
downloademacs-ff1c842a9477dee39fa20f885d64288b4947a040.tar.gz
emacs-ff1c842a9477dee39fa20f885d64288b4947a040.zip
Rephrase lexical binding requirement sentence.
* doc/lispref/control.texi (Pattern matching case statement): Rephrase lexical binding requirement: the example needs it, not `pcase' itself.
-rw-r--r--doc/lispref/ChangeLog5
-rw-r--r--doc/lispref/control.texi11
2 files changed, 11 insertions, 5 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index 595102bb5ef..738dd417fd2 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,8 @@
12013-12-25 Tassilo Horn <tsdh@gnu.org>
2
3 * control.texi (Pattern matching case statement): Rephrase lexical
4 binding requirement: the example needs it, not `pcase' itself.
5
12013-12-25 Chong Yidong <cyd@gnu.org> 62013-12-25 Chong Yidong <cyd@gnu.org>
2 7
3 * eval.texi (Eval): Document the LEXICAL arg to eval. 8 * eval.texi (Eval): Document the LEXICAL arg to eval.
diff --git a/doc/lispref/control.texi b/doc/lispref/control.texi
index a9e7236fc3a..f5cdd3dc80f 100644
--- a/doc/lispref/control.texi
+++ b/doc/lispref/control.texi
@@ -342,19 +342,20 @@ third elements and binds them to the variables @code{x} and @code{y}.
342@code{(pred numberp)} is a pattern that simply checks that @code{exp} 342@code{(pred numberp)} is a pattern that simply checks that @code{exp}
343is a number, and @code{_} is the catch-all pattern that matches anything. 343is a number, and @code{_} is the catch-all pattern that matches anything.
344 344
345Note that the the lambda being the result of the @code{fn} clause is a
346closure (@pxref{Closures}), so the file defining @code{evaluate} must
347have lexical binding enabled (@pxref{Using Lexical Binding}, for how
348to enable it).
349
345Here are some sample programs including their evaluation results: 350Here are some sample programs including their evaluation results:
346 351
347@example 352@example
348(evaluate '(add 1 2) nil) ;=> 3 353(evaluate '(add 1 2) nil) ;=> 3
349(evaluate '(add x y) '((x . 1) (y . 2))) ;=> 3 354(evaluate '(add x y) '((x . 1) (y . 2))) ;=> 3
350(evaluate '(call (fn x (add 1 x)) 2) nil) ;=> 3 355(evaluate '(call (fn x (add 1 x)) 2) nil) ;=> 3
351(evaluate '(sub 1 2) nil) ;=> (error "Unknown expression (sub 1 2)") 356(evaluate '(sub 1 2) nil) ;=> error
352@end example 357@end example
353 358
354Note that (parts of) @code{pcase} only work as expected with lexical
355binding, so lisp files using @code{pcase} should have enable it
356(@pxref{Using Lexical Binding}, for how to enable lexical binding).
357
358There are two kinds of patterns involved in @code{pcase}, called 359There are two kinds of patterns involved in @code{pcase}, called
359@emph{U-patterns} and @emph{Q-patterns}. The @var{upattern} mentioned above 360@emph{U-patterns} and @emph{Q-patterns}. The @var{upattern} mentioned above
360are U-patterns and can take the following forms: 361are U-patterns and can take the following forms: