diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2024-06-28 01:03:51 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2024-06-28 01:03:51 -0700 |
commit | d1ecf1d92d8162bc37b17b7050199a2a41b676c7 (patch) | |
tree | f6e4dff885e1c9c24ea6ecf15ca96caa56d3f0a8 /tests/011 | |
parent | fb3de91f6a24e32641a017c3f49ebb3e93bb1ddc (diff) | |
download | txr-d1ecf1d92d8162bc37b17b7050199a2a41b676c7.tar.gz txr-d1ecf1d92d8162bc37b17b7050199a2a41b676c7.tar.bz2 txr-d1ecf1d92d8162bc37b17b7050199a2a41b676c7.zip |
match: new @(scan-all) operator.
This is like @(scan) but collects all matches over the
suffixes of the list.
* autoload.c (match_set_entries): Intern scan-all symbol.
* stdlib/match.tl (compile-scan-all-match): New function.
(compile-match): Dispatch compile-scan-all-match on scan-all
symbol.
* tests/011/patmatch.tl: Tests for scanall and also missing
tests for scan.
* txr.1: Documented.
Diffstat (limited to 'tests/011')
-rw-r--r-- | tests/011/patmatch.tl | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/011/patmatch.tl b/tests/011/patmatch.tl index 6d071f3d..731a8796 100644 --- a/tests/011/patmatch.tl +++ b/tests/011/patmatch.tl @@ -612,6 +612,14 @@ (match @(sme (@a) (@b) @x) '(0 1 . 2) (list a b x)) (0 1 2) (match @(sme (@a) (@b) @(evenp @x)) '(0 1 . 2) (list a b x)) (0 1 2)) +(mtest + (match @(scan (b @x)) '(1 2 3 4 b 5 b 6 7 8) x) :error + (match @(scan (b @x . @nil)) '(1 2 3 4 b 5 b 6 7 8) x) 5) + +(mtest + (match @(scan-all (b @x)) '(1 2 3 4 b 5 b 6 7 8) x) :error + (match @(scan-all (b @x . @nil)) '(1 2 3 4 b 5 b 6 7 8) x) (5 6)) + (compile-only (eval-only (with-compile-opts (nil unused) |