From 2ccd4b1a95cd478730e3f55b6c3d6aa999815601 Mon Sep 17 00:00:00 2001 From: Sam Tobin-Hochstadt Date: Wed, 11 Mar 2015 16:15:17 -0400 Subject: [PATCH] Describe `match` scoping behavior more precisely. --- pkgs/racket-doc/scribblings/reference/match.scrbl | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pkgs/racket-doc/scribblings/reference/match.scrbl b/pkgs/racket-doc/scribblings/reference/match.scrbl index 7a950790e1..8dc610df97 100644 --- a/pkgs/racket-doc/scribblings/reference/match.scrbl +++ b/pkgs/racket-doc/scribblings/reference/match.scrbl @@ -22,9 +22,11 @@ on regular-expression matching on strings, bytes, and streams. Finds the first @racket[pat] that matches the result of @racket[val-expr], and evaluates the corresponding @racket[body]s with -bindings introduced by @racket[pat] (if any). The last @racket[body] +bindings introduced by @racket[pat] (if any). Bindings introduced by +@racket[pat] are not available in other parts of @racket[pat]. +The last @racket[body] in the matching clause is evaluated in tail position with respect to -the @racket[match] expression. +the @racket[match] expression. To find a match, the @racket[clause]s are tried in order. If no @racket[clause] matches, then the @exnraise[exn:misc:match?]. @@ -58,12 +60,13 @@ In more detail, patterns match as follows: @racketidfont{...}, @racketidfont{.._}, @racketidfont{..}@racket[_k], and @racketidfont{..}@racket[_k] for non-negative integers - @racket[_k]) or @racket[(var _id)] --- matches anything, and binds @racket[id] to the + @racket[_k]) or @racket[(var _id)] --- matches anything, and binds @racket[_id] to the matching values. If an @racket[_id] is used multiple times within a pattern, the corresponding matches must be the same according to @racket[(match-equality-test)], except that instances of an @racket[_id] in different @racketidfont{or} and - @racketidfont{not} sub-patterns are independent. + @racketidfont{not} sub-patterns are independent. The binding for @racket[_id] is + not available in other parts of the same pattern. @examples[ #:eval match-eval