(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 (let {[$pat >]} (match {1} (Multiset Integer) {[pat ] [_ ]}))) (test (match {1} (Multiset Integer) {[(| >) ] [_ ]})) (test (match-all { } (List Something) [ [xs ys]])) (test (match-all {1 2 3} (List Integer) [ [hs ts]])) (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 ((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-all {0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9} (Multiset Integer) [>>> [x y z]])) (test (match-all {0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9} (Multiset Integer) [>>> [x y z]])) (test (match {5 2 1 3 4} (Multiset Integer) {[>>>>> ] [_ ]})) (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 (destructor {[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-all {1 2 3 4 5} (List Integer) [>>> [m n]])) (test (match-all {1 2 3 4} (List Integer) [> ns])) (define $combination (lambda [$xs $k] (match k Nat {[ {{}}] [ (concat (match-all xs (List Something) [> (map (lambda [$ys] {x @ys}) (combination rs k1))]))]}))) (test (combination {1 2 3 4 5} 3)) > ... >> (... [$n Integer (squence 1 k (lambda [$i] (+ i 1)))] > _) (define $loop-pat (lambda [$k $i] (match i Integer {[,k >] [_ >]}))) (define $loop-pat (lambda [$k] (| ))) (define $isStraight? (lambda [$Ns] (match Ns (Multiset Integer) {[ ] [_ ]}))) (define $isStraight? (lambda [$Ns] (match Ns (Multiset Integer) {[ ] [_ ]}))) (test (isStraight? {1 2}))