diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-01-17 17:12:59 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-01-17 17:12:59 -0800 |
commit | 5378d3237ba7f9ba91d011536df3731d69516a5b (patch) | |
tree | a2fa7e7aa27dcc1f6a8f0f56cc6c0f0c8b15e3df | |
parent | 5d707f9c2b9428ed2b2288912d3f448724c93952 (diff) | |
download | txr-5378d3237ba7f9ba91d011536df3731d69516a5b.tar.gz txr-5378d3237ba7f9ba91d011536df3731d69516a5b.tar.bz2 txr-5378d3237ba7f9ba91d011536df3731d69516a5b.zip |
doc: document @(some) pattern operator.
-rw-r--r-- | txr.1 | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -40012,6 +40012,34 @@ operator behaves like a failed match when the list is empty. --> ((1 2 3) (a b c)) .brev +.coNP Pattern operator @ some +.synb +.mets @(some << pattern ) +.syne +.desc +The +.code some +pattern operator requires the corresponding object to be a list. +The specified +.meta pattern +is applied against every element of the list. The match is successful if +.meta pattern +finds a matching element. + +Variables are extracted from the first matching which is found. + +.TP* Example: + +.verb + ;; the second (x 2 b) element is the leftmost one + ;; which matches the (x @a @b) pattern + + (when-match @(some (x @a @b)) + '((y 1 a) (x 2 b) (z 3 c)) + (list a b)) + -> (2 b) +.brev + .SS* Quasiquote Operator Syntax .coNP Macro @ qquote .synb |