diff options
author | Kaz Kylheku <kazkylheku@vtech.ca> | 2021-01-18 19:59:36 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-01-18 19:59:36 -0800 |
commit | a91aff6dfa0d97c4130a3a7c630466b8ec2e247b (patch) | |
tree | 339b4109213548307cb780bc6e2f6119ee4f139d /txr.1 | |
parent | 1e081d603a1bf43b8a63d559a00aebb82a5bdb20 (diff) | |
download | txr-a91aff6dfa0d97c4130a3a7c630466b8ec2e247b.tar.gz txr-a91aff6dfa0d97c4130a3a7c630466b8ec2e247b.tar.bz2 txr-a91aff6dfa0d97c4130a3a7c630466b8ec2e247b.zip |
matcher: add @(not) operator.
* share/txr/stdlib/match.tl (compile-not-match): New function.
(compile-match): Hook in not operator.
* txr.1: Documented.
Diffstat (limited to 'txr.1')
-rw-r--r-- | txr.1 | 34 |
1 files changed, 34 insertions, 0 deletions
@@ -40104,6 +40104,40 @@ values. x) -> 2 .brev +.coNP Pattern operator @ not +.synb +.mets @(not << pattern ) +.syne +.desc +The pattern operator +.code not +provides logical inverse semantics. It matches if, and only if, the +.meta pattern +does not match. + +Whether or not the +.cond not +operator matches, no variables are bound. If the embedded +.meta pattern +matches, the variables which it binds are suppressed by the +.cond not +operator. + +.TP* Examples: + +.verb + ;; @a matches unconditionally, so @(not @a) always fails: + (match-if @(not @a) 1 :yes :no) -> no + + ;; error: a is not bound + (match-if @(not @a) 1 :yes a) -> error + + (match-case '(1 2 3) + ((@(not 1) @b @c) (list :case1 b c)) + ((@(not 0) @b @c) (list :case2 c b))) + --> (:case2 3 2) +.brev + .coNP Pattern operator @ op .synb .mets @(op << form +) |