From be31278685fc97b35f4ce540d42e9f6328343cbf Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Wed, 9 Oct 2024 07:16:41 +0900 Subject: [PATCH] Clarify there is no special meaning to else in match. Closes #1005. --- lib/chibi/match/match.scm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/chibi/match/match.scm b/lib/chibi/match/match.scm index f9cfb201..669529e9 100644 --- a/lib/chibi/match/match.scm +++ b/lib/chibi/match/match.scm @@ -32,6 +32,11 @@ ;;> If no patterns match an error is signalled. +;;> Note there is no \scheme{else} clause. \scheme{else} is sometimes +;;> used descriptively for the last pattern, since an identifier used +;;> only once matches anything, but it's preferred to use \scheme{_} +;;> described below. + ;;> Identifiers will match anything, and make the corresponding ;;> binding available in the body. @@ -128,7 +133,7 @@ ;;> are bound if the \scheme{or} operator matches, but the binding is ;;> only defined for identifiers from the subpattern which matched. -;;> \example{(match 1 ((or) #t) (else #f))} +;;> \example{(match 1 ((or) #t) (_ #f))} ;;> \example{(match 1 ((or x) x))} ;;> \example{(match 1 ((or x 2) x))}