diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-01-18 07:56:01 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-01-18 07:56:01 -0800 |
commit | 90f4a25db0f893b931098f37be07e5417b79faed (patch) | |
tree | 6d3ff7ce73f8766c9fa31b519db7be6e32353176 /tests | |
parent | fb2f2c8ea44b56a089c685656bffa08bc63d8ac5 (diff) | |
download | txr-90f4a25db0f893b931098f37be07e5417b79faed.tar.gz txr-90f4a25db0f893b931098f37be07e5417b79faed.tar.bz2 txr-90f4a25db0f893b931098f37be07e5417b79faed.zip |
doc: document when-match, if-match and match-case.
* tests/011/patmatch.tl: Add match-case test.
* txr.1: Document when-match, if-match and match-case.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/011/patmatch.tl | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/011/patmatch.tl b/tests/011/patmatch.tl index f930dd9f..eba15b2e 100644 --- a/tests/011/patmatch.tl +++ b/tests/011/patmatch.tl @@ -66,3 +66,17 @@ (test (if-match @(op <= 10 @1 13) 11 :yes :no) :yes) (test (when-match @(let x @(op <= 10 @1 13)) 11 x) 11) (test (when-match (@(evenp) @(oddp x)) '(2 3) x) 3) + +(test + (collect-each ((obj (list '(1 2 3) + '(4 5) + '(3 5) + #S(time year 2021 month 1 day 1) + #(vec tor)))) + (match-case obj + (@(struct time year @y) y) + (#(@x @y) (list x y)) + ((@nil @nil @x) x) + ((4 @x) x) + ((@x 5) x))) + (3 5 3 2021 (vec tor))) |