From 7428e1d6af1875c337533c760c83cd7dd797fdb6 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 10 Sep 2022 07:56:15 -0700 Subject: doc: document [. expr] support. * txr.1: Document and advise users that it doesn't work in 281 or older versions. --- txr.1 | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/txr.1 b/txr.1 index 1037fbc9..0f9ec8c6 100644 --- a/txr.1 +++ b/txr.1 @@ -12018,6 +12018,34 @@ or an atom as .codn "(. sym)" . +This notation is implemented for the square brackets, according to this +transformation: + +.verb + [. expr] -> (dwim . expr) +.brev + +This is useful in Structural Pattern Matching, allowing a pattern like + +.verb + [. @args] +.brev + +to match a +.code dwim +expression and capture all of its arguments in a variable, without having +to resort to the internal notation: + +Compatibility Note: support for +.code "[. expr]" +was introduced in \*(TX 282. Older versions do not read the syntax, +but do print +.code "(dwim . @var)" +as +.code "[. @var]" +which is then unreadable in those versions, breaking read-print +consistency. + .NP* Referencing Dot A dot token which is flanked by expressions on both sides, without any -- cgit v1.2.3