summaryrefslogtreecommitdiffstats
path: root/txr.1
diff options
context:
space:
mode:
Diffstat (limited to 'txr.1')
-rw-r--r--txr.123
1 files changed, 23 insertions, 0 deletions
diff --git a/txr.1 b/txr.1
index 860492e2..e4e224b9 100644
--- a/txr.1
+++ b/txr.1
@@ -39646,6 +39646,29 @@ notation. The reason is that a struct literal produces an object
which loses information about how it was specified in the literal syntax,
but those details are critically important in pattern matching.
+A pattern can contain multiple occurrences of the same variable.
+Except in the case when these variables occur in different branches
+of an
+.code @(or)
+or
+.code @(and)
+pattern operator, those repeated variables denote one variable.
+The left-most, or in the case of
+.code @(let)
+nesting, outermost, occurrence of the variable binds to the corresponding
+element of the object. The remaining occurrences of the variable must
+correspond to objects which are
+.code equal
+to that object, or else there is no match.
+For instance, the pattern
+.code "(@a @a)"
+matches a list like
+.code "(1 1)"
+and binds a to the leftmost
+.codn 1 ,
+and fails to match a list like
+.codn "(1 2)" .
+
The pattern-matching notation is documented in the following
sections; sections describing the pattern matching macros follow.