[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] fix/bug-31311-pcase-doc 1b67f5f 2/9: do ‘s/exp/form/g’ fo
From: |
Thien-Thi Nguyen |
Subject: |
[Emacs-diffs] fix/bug-31311-pcase-doc 1b67f5f 2/9: do ‘s/exp/form/g’ for ‘evaluate’ + explanation |
Date: |
Thu, 17 May 2018 06:41:56 -0400 (EDT) |
branch: fix/bug-31311-pcase-doc
commit 1b67f5febacc6c64535e4d5851d6c8e35f0c584f
Author: Thien-Thi Nguyen <address@hidden>
Commit: Thien-Thi Nguyen <address@hidden>
do ‘s/exp/form/g’ for ‘evaluate’ + explanation
This node is already stuffed w/ "exp" (and some "expr" as well).
Using "form" helps reduce possibility of reader aliasing overload.
---
doc/lispref/control.texi | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/doc/lispref/control.texi b/doc/lispref/control.texi
index 6695900..ec50e8d 100644
--- a/doc/lispref/control.texi
+++ b/doc/lispref/control.texi
@@ -805,8 +805,8 @@ interpreter for a little expression language (note that
this example
requires lexical binding, @pxref{Lexical Binding}):
@example
-(defun evaluate (exp env)
- (pcase exp
+(defun evaluate (form env)
+ (pcase form
(`(add ,x ,y) (+ (evaluate x env)
(evaluate y env)))
(`(call ,fun ,arg) (funcall (evaluate fun env)
@@ -814,18 +814,18 @@ requires lexical binding, @pxref{Lexical Binding}):
(`(fn ,arg ,body) (lambda (val)
(evaluate body (cons (cons arg val)
env))))
- ((pred numberp) exp)
- ((pred symbolp) (cdr (assq exp env)))
- (_ (error "Unknown expression %S" exp))))
+ ((pred numberp) form)
+ ((pred symbolp) (cdr (assq form env)))
+ (_ (error "Unknown expression %S" form))))
@end example
-Here @code{`(add ,x ,y)} is a pattern that checks that @code{exp} is a
+Here @code{`(add ,x ,y)} is a pattern that checks that @code{form} is a
three-element list starting with the literal symbol @code{add}, then
extracts the second and third elements and binds them to the variables
@code{x} and @code{y}. Then it evaluates @code{x} and @code{y} and
adds the results. The @code{call} and @code{fn} patterns similarly
implement two flavors of function calls. @code{(pred numberp)} is a
-pattern that simply checks that @code{exp} is a number and if so,
+pattern that simply checks that @code{form} is a number and if so,
evaluates it. @code{(pred symbolp)} matches symbols, and returns
their association. Finally, @code{_} is the catch-all pattern that
matches anything, so it's suitable for reporting syntax errors.
- [Emacs-diffs] fix/bug-31311-pcase-doc updated (707c81f -> 2b1cc77), Thien-Thi Nguyen, 2018/05/17
- [Emacs-diffs] fix/bug-31311-pcase-doc 71e4791 1/9: refill func ‘evaluate’ (less horiz, more vert), Thien-Thi Nguyen, 2018/05/17
- [Emacs-diffs] fix/bug-31311-pcase-doc 1ecece4 3/9: say "Syntax error" in last ‘evaluate’ BODY-FORM, Thien-Thi Nguyen, 2018/05/17
- [Emacs-diffs] fix/bug-31311-pcase-doc 1b67f5f 2/9: do ‘s/exp/form/g’ for ‘evaluate’ + explanation,
Thien-Thi Nguyen <=
- [Emacs-diffs] fix/bug-31311-pcase-doc 30a7b23 4/9: make para following ‘evaluate’ code a continuation, Thien-Thi Nguyen, 2018/05/17
- [Emacs-diffs] fix/bug-31311-pcase-doc fbfabfb 6/9: add Issue comment; nfc, Thien-Thi Nguyen, 2018/05/17
- [Emacs-diffs] fix/bug-31311-pcase-doc 6abf621 5/9: add subsection ‘Extending @code{pcase}’, Thien-Thi Nguyen, 2018/05/17
- [Emacs-diffs] fix/bug-31311-pcase-doc 070b784 8/9: use address@hidden in ‘evaluate’ small-program session, Thien-Thi Nguyen, 2018/05/17
- [Emacs-diffs] fix/bug-31311-pcase-doc e0cda90 7/9: rework ‘evaluate’ explanation, Thien-Thi Nguyen, 2018/05/17
- [Emacs-diffs] fix/bug-31311-pcase-doc 2b1cc77 9/9: drop "Here, " from ‘evaluate’ explanation, Thien-Thi Nguyen, 2018/05/17