[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] fix/bug-31311-pcase-doc 9164317 3/8: present core pattern
From: |
Thien-Thi Nguyen |
Subject: |
[Emacs-diffs] fix/bug-31311-pcase-doc 9164317 3/8: present core pattern ‘and’ before ‘or’ |
Date: |
Sat, 19 May 2018 07:39:36 -0400 (EDT) |
branch: fix/bug-31311-pcase-doc
commit 9164317c9832986a645e4e0e6685ea3e0e686d41
Author: Thien-Thi Nguyen <address@hidden>
Commit: Thien-Thi Nguyen <address@hidden>
present core pattern ‘and’ before ‘or’
ISTM ‘and’ is simpler to explain and understand.
Leading w/ simpler tends to yield a better reader experience.
- (docstring) transpose lines
- (texi) transpose @item entries in table
---
doc/lispref/control.texi | 14 +++++++-------
lisp/emacs-lisp/pcase.el | 2 +-
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/doc/lispref/control.texi b/doc/lispref/control.texi
index 101109f..dbc1fd4 100644
--- a/doc/lispref/control.texi
+++ b/doc/lispref/control.texi
@@ -448,6 +448,13 @@ and matches if @var{exprval} matches @var{pattern}.
(It is called @code{let} because
@var{pattern} can bind symbols to values using @var{symbol}.)
address@hidden (and @address@hidden)
+Attempts to match @address@hidden, in order,
+until one of them fails to match.
+In that case, @code{and} likewise fails to match,
+and the rest of the sub-patterns are not tested.
+If all sub-patterns match, @code{and} matches.
+
@item (or @var{pattern1} @address@hidden)
Attempts to match @var{pattern1}, @var{pattern2}, @dots{}, in order,
until one of them succeeds.
@@ -468,13 +475,6 @@ should all bind the same symbols.
@c since the error is raised during BODY-FORMS evaluation.
@c Maybe ‘s/on match/and avoid a symbol resolution error &/’
@c along w/ ‘s/should/must/’?
-
address@hidden (and @address@hidden)
-Attempts to match @address@hidden, in order,
-until one of them fails to match.
-In that case, @code{and} likewise fails to match,
-and the rest of the sub-patterns are not tested.
-If all sub-patterns match, @code{and} matches.
@end table
@anchor{pcase-example-0}
diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el
index ffc1f52..ee206a5 100644
--- a/lisp/emacs-lisp/pcase.el
+++ b/lisp/emacs-lisp/pcase.el
@@ -130,8 +130,8 @@ PATTERN matches. PATTERN can take one of the forms:
(app FUN PAT) matches if FUN called on EXPVAL matches PAT.
(guard BOOLEXP) matches if BOOLEXP evaluates to non-nil.
(let PAT EXPR) matches if EXPR matches PAT.
- (or PAT...) matches if any of the patterns matches.
(and PAT...) matches if all the patterns match.
+ (or PAT...) matches if any of the patterns matches.
FUN in `pred' and `app' can take one of the forms:
SYMBOL or (lambda ARGS BODY)
- [Emacs-diffs] fix/bug-31311-pcase-doc updated (2b1cc77 -> b870f3f), Thien-Thi Nguyen, 2018/05/19
- [Emacs-diffs] fix/bug-31311-pcase-doc 658699c 1/8: do ‘s/cl-case/case/g’, Thien-Thi Nguyen, 2018/05/19
- [Emacs-diffs] fix/bug-31311-pcase-doc 9164317 3/8: present core pattern ‘and’ before ‘or’,
Thien-Thi Nguyen <=
- [Emacs-diffs] fix/bug-31311-pcase-doc 4008976 5/8: rework ‘or’ same-symbols para, Thien-Thi Nguyen, 2018/05/19
- [Emacs-diffs] fix/bug-31311-pcase-doc f2c9983 2/8: explain ‘or’ same-symbols caveat, Thien-Thi Nguyen, 2018/05/19
- [Emacs-diffs] fix/bug-31311-pcase-doc 0133e9a 6/8: add some @group; rework example to use fewer lines, Thien-Thi Nguyen, 2018/05/19
- [Emacs-diffs] fix/bug-31311-pcase-doc 701142f 7/8: add some missing @result{}, Thien-Thi Nguyen, 2018/05/19
- [Emacs-diffs] fix/bug-31311-pcase-doc b870f3f 8/8: add some @group, Thien-Thi Nguyen, 2018/05/19
- [Emacs-diffs] fix/bug-31311-pcase-doc 712f4d7 4/8: formalize SEQPAT, Thien-Thi Nguyen, 2018/05/19