@(load `@{stdlib}txr-case`) @(include "../common") @(define date (year month day)) @{year /\d\d\d\d/}-@{month /\d\d/}-@{day /\d\d/} @(end) @(do (each ((date '("09-10-20" "2009-10-20" "July-15-2014" "foo"))) (txr-if date (y m d) date (put-line `match: year @y, month @m, day @d`) (put-line `no match for @date`)))) @(define notmatch ()) blah @(end) @(define stuff (year month day a b)) @(date year month day) @a @b @(end) @(do (txr-case (make-strlist-input-stream '("2021-06-16" "foo bar")) (notmatch () (put-line "notexpected")) (stuff (y m d a b) (put-line `match: year @y, month @m, day @d, @a:@b`))) (mtest (match-fboundp 'notmatch) t (match-fboundp 'stuff) t (match-fboundp 'xyzzy) nil))