[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] fix/bug-31311-pcase-doc 0f1c170 06/18: settle on address@
From: |
Thien-Thi Nguyen |
Subject: |
[Emacs-diffs] fix/bug-31311-pcase-doc 0f1c170 06/18: settle on address@hidden pcase’ text |
Date: |
Tue, 15 May 2018 05:45:53 -0400 (EDT) |
branch: fix/bug-31311-pcase-doc
commit 0f1c170db2fdad01784f53396a5b50f61f2ecd3f
Author: Thien-Thi Nguyen <address@hidden>
Commit: Thien-Thi Nguyen <address@hidden>
settle on address@hidden pcase’ text
- introduce address@hidden
- use "Variant C" :-D
- go w/ "body-forms" for now :-/
- zonk original text
---
doc/lispref/control.texi | 50 ++++++------------------------------------------
1 file changed, 6 insertions(+), 44 deletions(-)
diff --git a/doc/lispref/control.texi b/doc/lispref/control.texi
index 632dc0d..91e62f8 100644
--- a/doc/lispref/control.texi
+++ b/doc/lispref/control.texi
@@ -308,55 +308,17 @@ literal value (for comparisons to literal values you'd use
@code{cond}), or it can be a more general description of the expected
structure of the expression's value.
address@hidden Issue: Personally, i'd prefer to ‘s/body-forms/body/g’, but maybe
address@hidden consistency w/ the ‘cond’ docs is more important. Hmm.
--ttn
-
@defmac pcase expression &rest clauses
-Each clause has the form: @code{(@var{pattern} @address@hidden)}.
address@hidden R: Describing structure early (near the @def) helps chunking.
address@hidden (Indeed, for simple forms, the @def line is sufficient.)
address@hidden Qs answered:
address@hidden (a) What are the parts?
address@hidden (b) What are their names?
address@hidden (c) What is the un-named support structure (syntax)?
address@hidden Issue: Whether or not to include ``... in @var{clauses} ...''.
-
address@hidden Variant A
address@hidden R: Key words are ``attempt'' and ``in order'',
address@hidden which clearly conveys the iterative nature.
-Evaluate @var{expression}, attempt to match the value of
address@hidden with @var{pattern} of each clause in order,
-and pass control to @var{body-forms} of the clause that matches.
-
address@hidden Variant B
address@hidden R: Better flow (to the author's ear), but perhaps iterative
address@hidden nature (implied by ``first'') too easy to overlook.
address@hidden OTOH, key word ``successful'' hints at possibility of
address@hidden failure, which implies ``attempt'' at something.
address@hidden What could that something be, but a search (iterative)?
-Evaluate @var{expression} and pass control to @var{body-forms}
-of the first clause in @var{clauses} whose @var{pattern}
-is a successful match for the value of @var{expression}.
+Each clause in @var{clauses} has the form:
address@hidden@code{(@var{pattern} @address@hidden)}}.
+
+Evaluate @var{expression} to determine its value, @var{expval}.
+Find the first clause in @var{clauses} whose @var{pattern} matches
address@hidden and pass control to that clause's @var{body-forms}.
If there is a match, the value of @code{pcase} is the value
of the last of @var{body-forms} in the successful clause.
Otherwise, @code{pcase} evaluates to @code{nil}.
address@hidden See, using ``body'' instead of ``body-forms'' allows for:
address@hidden If there is a match, the value of @code{pcase} is the value
address@hidden of the last @var{body} form in the successful clause.
address@hidden which could surely be further improved... /whine --ttn
-
address@hidden Original text.
-Evaluate @var{expression} and choose among an arbitrary number of
-alternatives based on the value of @var{expression}. The possible
-alternatives are specified by @var{clauses}, each of which must be a
-list of the form @code{(@var{pattern} @address@hidden)}.
address@hidden tries to match the value of @var{expression} to the
address@hidden of each clause, in textual order. If the value matches,
-the clause succeeds; @code{pcase} then evaluates its @var{body-forms},
-and returns the value of the last of @var{body-forms}. Any remaining
address@hidden are ignored. If no clauses match, then the @code{pcase}
-form evaluates to @code{nil}.
@end defmac
The rest of this subsection describes the builtin @var{pattern}
- [Emacs-diffs] fix/bug-31311-pcase-doc updated (2eb044b -> 484c3ae), Thien-Thi Nguyen, 2018/05/15
- [Emacs-diffs] fix/bug-31311-pcase-doc 5c3da48 01/18: (docstring) [2nd para] use ‘PATTERN’ as proper noun, Thien-Thi Nguyen, 2018/05/15
- [Emacs-diffs] fix/bug-31311-pcase-doc 492dd6c 04/18: use address@hidden, address@hidden as proper noun, Thien-Thi Nguyen, 2018/05/15
- [Emacs-diffs] fix/bug-31311-pcase-doc b3fb63e 05/18: zonk "Depending on the pattern" para (superseded by SYMBOL expansion), Thien-Thi Nguyen, 2018/05/15
- [Emacs-diffs] fix/bug-31311-pcase-doc 15378c3 08/18: do ‘s/predicate function/predicate/’, Thien-Thi Nguyen, 2018/05/15
- [Emacs-diffs] fix/bug-31311-pcase-doc f2610c6 11/18: for ‘app’, refine comparison w/ ‘pred’, Thien-Thi Nguyen, 2018/05/15
- [Emacs-diffs] fix/bug-31311-pcase-doc abf7e6a 03/18: zonk "side-effecting" Issue comment lines, Thien-Thi Nguyen, 2018/05/15
- [Emacs-diffs] fix/bug-31311-pcase-doc c0f0f18 07/18: zonk later address@hidden introduction (superseded), Thien-Thi Nguyen, 2018/05/15
- [Emacs-diffs] fix/bug-31311-pcase-doc 0f1c170 06/18: settle on address@hidden pcase’ text,
Thien-Thi Nguyen <=
- [Emacs-diffs] fix/bug-31311-pcase-doc dc4b413 09/18: do ‘s/predfun/function/g’, Thien-Thi Nguyen, 2018/05/15
- [Emacs-diffs] fix/bug-31311-pcase-doc 5e2eeee 17/18: transform ‘get-return-code’ example, Thien-Thi Nguyen, 2018/05/15
- [Emacs-diffs] fix/bug-31311-pcase-doc e276ce7 13/18: transform ‘guard’ example, Thien-Thi Nguyen, 2018/05/15
- [Emacs-diffs] fix/bug-31311-pcase-doc ff41db6 12/18: (docstring) quote ‘pcase’ in QPAT docstring, Thien-Thi Nguyen, 2018/05/15
- [Emacs-diffs] fix/bug-31311-pcase-doc bd79b06 15/18: add anchor/heading to examples; fix typo, Thien-Thi Nguyen, 2018/05/15
- [Emacs-diffs] fix/bug-31311-pcase-doc d5dfe0e 02/18: expand on SYMBOL, Thien-Thi Nguyen, 2018/05/15
- [Emacs-diffs] fix/bug-31311-pcase-doc 0dffb69 10/18: (docstring) do s/predicate function/predicate/g, s/specified/formed/g, Thien-Thi Nguyen, 2018/05/15
- [Emacs-diffs] fix/bug-31311-pcase-doc 4ede733 16/18: refine example header, grouping, Thien-Thi Nguyen, 2018/05/15
- [Emacs-diffs] fix/bug-31311-pcase-doc 484c3ae 18/18: add xref to ‘(cl) Conditionals’, Thien-Thi Nguyen, 2018/05/15
- [Emacs-diffs] fix/bug-31311-pcase-doc 279d548 14/18: transform ‘let’ example, Thien-Thi Nguyen, 2018/05/15