diff options
| author | Tassilo Horn | 2013-12-25 10:12:24 +0100 |
|---|---|---|
| committer | Tassilo Horn | 2013-12-25 10:12:24 +0100 |
| commit | ff1c842a9477dee39fa20f885d64288b4947a040 (patch) | |
| tree | 36261c735781ece4dc7cb04ee4b9577cf618657e | |
| parent | 362397edd9f48bf431c8ea4ca2a88d15c5660bde (diff) | |
| download | emacs-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/ChangeLog | 5 | ||||
| -rw-r--r-- | doc/lispref/control.texi | 11 |
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 @@ | |||
| 1 | 2013-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 | |||
| 1 | 2013-12-25 Chong Yidong <cyd@gnu.org> | 6 | 2013-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} |
| 343 | is a number, and @code{_} is the catch-all pattern that matches anything. | 343 | is a number, and @code{_} is the catch-all pattern that matches anything. |
| 344 | 344 | ||
| 345 | Note that the the lambda being the result of the @code{fn} clause is a | ||
| 346 | closure (@pxref{Closures}), so the file defining @code{evaluate} must | ||
| 347 | have lexical binding enabled (@pxref{Using Lexical Binding}, for how | ||
| 348 | to enable it). | ||
| 349 | |||
| 345 | Here are some sample programs including their evaluation results: | 350 | Here 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 | ||
| 354 | Note that (parts of) @code{pcase} only work as expected with lexical | ||
| 355 | binding, so lisp files using @code{pcase} should have enable it | ||
| 356 | (@pxref{Using Lexical Binding}, for how to enable lexical binding). | ||
| 357 | |||
| 358 | There are two kinds of patterns involved in @code{pcase}, called | 359 | There 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 |
| 360 | are U-patterns and can take the following forms: | 361 | are U-patterns and can take the following forms: |