diff options
author | Tassilo Horn <tsdh@gnu.org> | 2013-12-25 10:12:24 +0100 |
---|---|---|
committer | Tassilo Horn <tsdh@gnu.org> | 2013-12-25 10:12:24 +0100 |
commit | ff1c842a9477dee39fa20f885d64288b4947a040 (patch) | |
tree | 36261c735781ece4dc7cb04ee4b9577cf618657e /doc/lispref/control.texi | |
parent | 362397edd9f48bf431c8ea4ca2a88d15c5660bde (diff) | |
download | emacs-ff1c842a9477dee39fa20f885d64288b4947a040.tar.gz |
Rephrase lexical binding requirement sentence.
* doc/lispref/control.texi (Pattern matching case statement): Rephrase lexical
binding requirement: the example needs it, not `pcase' itself.
Diffstat (limited to 'doc/lispref/control.texi')
-rw-r--r-- | doc/lispref/control.texi | 11 |
1 files changed, 6 insertions, 5 deletions
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}. @code{(pred numberp)} is a pattern that simply checks that @code{exp} is a number, and @code{_} is the catch-all pattern that matches anything. +Note that the the lambda being the result of the @code{fn} clause is a +closure (@pxref{Closures}), so the file defining @code{evaluate} must +have lexical binding enabled (@pxref{Using Lexical Binding}, for how +to enable it). + Here are some sample programs including their evaluation results: @example (evaluate '(add 1 2) nil) ;=> 3 (evaluate '(add x y) '((x . 1) (y . 2))) ;=> 3 (evaluate '(call (fn x (add 1 x)) 2) nil) ;=> 3 -(evaluate '(sub 1 2) nil) ;=> (error "Unknown expression (sub 1 2)") +(evaluate '(sub 1 2) nil) ;=> error @end example -Note that (parts of) @code{pcase} only work as expected with lexical -binding, so lisp files using @code{pcase} should have enable it -(@pxref{Using Lexical Binding}, for how to enable lexical binding). - There are two kinds of patterns involved in @code{pcase}, called @emph{U-patterns} and @emph{Q-patterns}. The @var{upattern} mentioned above are U-patterns and can take the following forms: |