diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-02-01 23:48:35 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-02-01 23:48:35 -0800 |
commit | 3546eefbbaefac9457e4f18c1d2ed0aba5a6b933 (patch) | |
tree | 6207b95d72877ba7a9c4e5cff6e81c6ed5f04cc3 /tests/011/patmatch.tl | |
parent | f98f2a73750bff9b182c74d073a9c78e5316d7ae (diff) | |
download | txr-3546eefbbaefac9457e4f18c1d2ed0aba5a6b933.tar.gz txr-3546eefbbaefac9457e4f18c1d2ed0aba5a6b933.tar.bz2 txr-3546eefbbaefac9457e4f18c1d2ed0aba5a6b933.zip |
matcher: new @(with) operator.
* lisplib.c (match_instantiate): Ensure usr:with is interned.
* share/txr/stdlib/match.tl (compile-with-match): New
function.
(compile-match): Wire in with operator.
* tests/011/patmatch.tl: Test cases.
* txr.1: Documented.
Diffstat (limited to 'tests/011/patmatch.tl')
-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 f8f6b03f..0068eabb 100644 --- a/tests/011/patmatch.tl +++ b/tests/011/patmatch.tl @@ -116,6 +116,14 @@ (test (when-match (@a @(as a @(or x @a))) '(#1=(1 2 #1# 3) #1#) :yes) :yes) +(test (when-match (@(with x 42 @a) @b @c) '(1 2 3) (list a b c x)) + (1 2 3 42)) + +(test (let ((o 3)) + (when-match (@(evenp x) @(with @(oddp y) o @z)) '(4 6) + (list x y z))) + (4 3 6)) + (defstruct node () left right) |