aboutsummaryrefslogtreecommitdiffstats
path: root/match-test.csc
diff options
context:
space:
mode:
authorRose Hogenson <rhogenson@posteo.net>2022-01-09 11:36:20 -0800
committerRose Hogenson <rhogenson@posteo.net>2022-01-09 11:36:20 -0800
commit6064e82e88b9a1d652b68bd1ea64f229aa76dd65 (patch)
tree36569f9363739630c94e3215c7a14e4e42f72260 /match-test.csc
parentAdd a library for pattern matching. (diff)
downloadchromatopelma-6064e82e88b9a1d652b68bd1ea64f229aa76dd65.tar.zst
Add wildcard to pattern syntax.
Diffstat (limited to 'match-test.csc')
-rw-r--r--match-test.csc12
1 files changed, 10 insertions, 2 deletions
diff --git a/match-test.csc b/match-test.csc
index 3fed862..2728e44 100644
--- a/match-test.csc
+++ b/match-test.csc
@@ -18,7 +18,7 @@
(1 1)
(2 2)
(3 3)
- (else 4))
+ (_ 4))
3)
(test-case
"match-list"
@@ -27,12 +27,20 @@
((1 2) 1)
((1 2 3) 2)
((1 2 3 4) 3)
- (else 4))
+ (_ 4))
2)
(test-case
"binding"
(match '(1 2 3)
((1 (! x) 3) x))
+ 2)
+ (test-case
+ "ignore"
+ (match '(1 2 3)
+ ((_ _ _ _) 0)
+ ((2 _ _) 1)
+ ((1 _ _) 2)
+ (_ 3))
2))))
(for-each
(lambda (tc)