[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] fix/bug-31311-pcase-doc 877cf63 6/8: bifurcate "U-pattern"
From: |
Thien-Thi Nguyen |
Subject: |
[Emacs-diffs] fix/bug-31311-pcase-doc 877cf63 6/8: bifurcate "U-pattern" |
Date: |
Wed, 16 May 2018 14:49:56 -0400 (EDT) |
branch: fix/bug-31311-pcase-doc
commit 877cf6387c7c4055a849e5d537190cfa1cccce04
Author: Thien-Thi Nguyen <address@hidden>
Commit: Thien-Thi Nguyen <address@hidden>
bifurcate "U-pattern"
- drop term "builtin"
- for ‘pcase’ main, call it "core pattern"
- zonk ‘unquoted : quoted :: U-pattern : Q-pattern’ para
- for backquote, call it "pattern" (except for lit.obj.)
---
doc/lispref/control.texi | 39 +++++++++++++++++----------------------
1 file changed, 17 insertions(+), 22 deletions(-)
diff --git a/doc/lispref/control.texi b/doc/lispref/control.texi
index 99a5d8d..6375d01 100644
--- a/doc/lispref/control.texi
+++ b/doc/lispref/control.texi
@@ -321,18 +321,13 @@ of the last of @var{body-forms} in the successful clause.
Otherwise, @code{pcase} evaluates to @code{nil}.
@end defmac
-The rest of this subsection describes the builtin @var{pattern}
address@hidden Issue: For presentation, we ‘s/U-pattern/core pattern/g’.
address@hidden ISTM (from a quick grep) ``core'' is not overused.
address@hidden Is there a better term?
+The rest of this subsection describes the core @var{pattern}
forms, and concludes with a another Lisp macro you can use to
-extend the set of builtin @var{pattern} forms.
-
address@hidden backquote (@code{pcase} syntax)
-The builtin set includes two broad categories of @var{pattern}
-forms: ``unquoted'' and ``quoted'', also known as
address@hidden and @dfn{Q-pattern}, respectively.
-A Q-pattern begins with a backquote and often builds
-upon one or more simpler U-patterns.
-
-A U-pattern can have the following forms:
+extend the core set.
+A core pattern can have the following forms:
@table @code
@@ -423,7 +418,7 @@ Simply @address@hidden(or @var{pattern1})}} signals error.)
@c TODO: Pick one: (a) drop; (b) forw-ref caveat.
For this reason,
-if any of the U-patterns let-bind symbols to the matched value, they
+if any of the sub-patterns let-binds symbols to the matched value, they
should all bind the same symbols.
@item (and @address@hidden)
@@ -750,19 +745,19 @@ Matches if @var{expval} is a vector of length @var{m}
whose
Matches if the corresponding element of @var{expval} is
@code{equal} to the specified object.
Note that, aside from @var{symbol}, this is the same set of
-self-quoting types that are acceptable as a U-pattern.
+self-quoting types that are acceptable as a core pattern.
address@hidden ,@var{upattern}
address@hidden ,@var{pattern}
Matches if the corresponding element of @var{expval}
-matches the specified @var{upattern}.
+matches the @var{pattern}.
@end table
-Note that uses of Q-patterns can be expressed using only U-patterns, as
-Q-patterns are implemented on top of U-patterns using
+Note that uses of Q-patterns can be expressed using only core
+patterns, as Q-patterns are implemented on top of core patterns using
@code{pcase-defmacro}, described below. However, using Q-patterns will
in many cases lead to a more readable code.
@c FIXME: There should be an example here showing how a 'pcase' that
address@hidden uses Q-patterns can be rewritten using U-patterns.
address@hidden uses Q-patterns can be rewritten using core patterns.
Here is an example of using @code{pcase} to implement a simple
interpreter for a little expression language (note that this example
@@ -801,14 +796,14 @@ evaluation results:
(evaluate '(sub 1 2) nil) ;=> error
@end example
-Additional U-patterns can be defined using the @code{pcase-defmacro}
+Additional patterns can be defined using the @code{pcase-defmacro}
macro.
@defmac pcase-defmacro name args [doc] &rest body
-Define a new kind of U-pattern for @code{pcase}. The new U-pattern will
+Define a new kind of pattern for @code{pcase}. The new pattern will
be invoked as @code{(@var{name} @var{actual-args})}. The @var{body}
-should describe how to rewrite the U-pattern @var{name} into some other
-U-pattern. The rewriting will be the result of evaluating @var{body}
+should describe how to rewrite the pattern @var{name} into some other
+pattern. The rewriting will be the result of evaluating @var{body}
in an environment where @var{args} are bound to @var{actual-args}.
For documentation consistency, use @code{EXPVAL}
- [Emacs-diffs] fix/bug-31311-pcase-doc updated (2db5695 -> 707c81f), Thien-Thi Nguyen, 2018/05/16
- [Emacs-diffs] fix/bug-31311-pcase-doc bdbe79a 1/8: minor clarifications, Thien-Thi Nguyen, 2018/05/16
- [Emacs-diffs] fix/bug-31311-pcase-doc 0f3563b 4/8: use @code instead of `docstring-style' quoting, Thien-Thi Nguyen, 2018/05/16
- [Emacs-diffs] fix/bug-31311-pcase-doc 4cf4faa 5/8: (docstring) ensure backquote is output first, Thien-Thi Nguyen, 2018/05/16
- [Emacs-diffs] fix/bug-31311-pcase-doc d2a0b3b 2/8: refine side-effect example, Thien-Thi Nguyen, 2018/05/16
- [Emacs-diffs] fix/bug-31311-pcase-doc ba2e20e 3/8: say address@hidden instead of @code{t}, Thien-Thi Nguyen, 2018/05/16
- [Emacs-diffs] fix/bug-31311-pcase-doc 3f614b6 7/8: rewrite intro, Thien-Thi Nguyen, 2018/05/16
- [Emacs-diffs] fix/bug-31311-pcase-doc 877cf63 6/8: bifurcate "U-pattern",
Thien-Thi Nguyen <=
- [Emacs-diffs] fix/bug-31311-pcase-doc 707c81f 8/8: don't quote "equality test"; use instead "the equality test", Thien-Thi Nguyen, 2018/05/16