(test (match-all {{1 2 3} {11} {21 22}} (List (Multiset Integer)) [ >>> [x y z]])) (test (match-all {{1 2 3 4 5} {4 5 1} {6 1 7 4}} (List (Multiset Integer)) [ >>> n])) (test (match-all {1 2 3 4 5} (Multiset Integer) [> [m n]])) (test (match (with $loop {1 @loop}) (List Integer) {[> [m n]] [_ ]})) (test (let {[$pat >]} (match {1} (Multiset Integer) {[pat ] [_ ]}))) (test (match {1} (Multiset Integer) {[(of { >}) ] [_ ]})) (test (let {[$loop loop})>]} (match {1 1 1 1} (Multiset Integer) {[loop ] [_ ]}))) (test (match {1 1 1 1} (Multiset Integer) {[(with $loop loop})>) ] [_ ]})) (test (match {1 1 1 1} (Multiset Integer) {[ loop})>)> ] [_ ]})) (test (match {0 1 0 1} (List Integer) {[(of { }))> }))>}) ] [_ ]})) (test (match-all { } (List Something) [ [xs ys]])) (test (match-all {1 2 3} (List Integer) [ [hs ts]])) (test (match-all {1 2 3} (Multiset Integer) [ [hs ts]])) (test (match-all {1 2 3} (Set Integer) [ [hs ts]])) (test (match-all {1 2 3} (List Integer) [> [hs x ts]])) (test (match-all {1 2 3} (Multiset Integer) [> [hs x ts]])) (test (match-all {1 2 3} (Set Integer) [> [hs x ts]])) (test ((remove-collection Suit) { } { })) (test (subcollections { })) (test (poker-hands { 4> 2> 5> 1> 3>})) (test (poker-hands { 1> 2> 1> 1> 2>})) (test (poker-hands { 4> 2> 5> 1> 3>})) (test (poker-hands { 4> 10> 5> 1> 3>})) (test (match {2 7 7 2 7} (Multiset Integer) {[>>>>> ] [_ ]})) (test (match {5 2 1 3 4} (Multiset Integer) {[>>>>> ] [_ ]})) (test (match-all {1 2 3 4 5} (Multiset Integer) [ [n rest]])) (test (let {[$f (lambda [$x] (+ (g x) 10))] [$g (lambda [$x] (+ x 1))]} (f 0))) (define $Stick (lambda [$a] (type {[$var-match (lambda [$tgt] {tgt})] [$inductive-match (deconstructor {[nil [] {[$tgt (match-all tgt (List a) [ []])]}] [cons [a (List a)] {[$tgt {@(match-all tgt (List a) [ [x xs]]) @(match-all (reverse tgt) (List a) [ [x xs]])}]}] [join [(List a) (List a)] {[$tgt {@(match-all tgt (List a) [ [xs ys]]) @(match-all (reverse tgt) (List a) [ [xs ys]])}]}]})] [$equal? (lambda [$val $tgt] (or ((type-ref (List a) equal?) val tgt) ((type-ref (List a) equal?) val (reverse tgt))))]}))) (test (match-all {1 2 3} (Stick Integer) [ [x xs]])) (test (match-all {1 2 3} (Stick Integer) [ [xs ys]])) (test (match-all {1 2 3 4} (Stick Integer) [> [xs w ys]])) (test (match-all {1 2 3} (Stick Integer) [,{3 2 1} ])) (test (match {2 7 7 2 7} (Multiset Integer) {[>> (match tmp1 (Multiset Integer) {[ (match tmp2 (Multiset Integer) {[ (match tmp3 (Multiset Integer) {[ ]})]})]})] [_ ]})) (test (match-all {1 2 3 4 5} (List Integer) [>>> [m n]])) (test (match-all {1 2 3 4} (List Integer) [> ns]))