(test (match-all {{1 2 3} {4 5 1} {6 1 7}} (List (Multiset Number)) [ >>> [x y z]])) (test (match-all {{1 2 3 4 5} {4 5 1} {6 1 7 4}} (List (Multiset Number)) [ >>> n])) (test (match (with $loop {1 @loop}) (List Number) {[> [m n]] [_ ]})) (test (let {[$pat >]} (match {1} (Multiset Number) {[pat ] [_ ]}))) (test (match {1} (Multiset Number) {[(of { >}) ] [_ ]})) (test (let {[$loop loop})>]} (match {1 1 1 1} (Multiset Number) {[loop ] [_ ]}))) (test (match {1 1 1 1} (Multiset Number) {[(with $loop loop})>) ] [_ ]})) (test (match {1 1 1 1} (Multiset Number) {[ loop})>)> ] [_ ]})) (test (match {0 1 0 1} (List Number) {[(of { }))> }))>}) ] [_ ]})) (test (match-all { } (List Something) [ [xs ys]])) (test (match-all {1 2 3} (List Number) [ [hs ts]])) (test (match-all {1 2 3} (Multiset Number) [ [hs ts]])) (test (match-all {1 2 3} (Set Number) [ [hs ts]])) (test (match-all {1 2 3} (List Number) [> [hs x ts]])) (test (match-all {1 2 3} (Multiset Number) [> [hs x ts]])) (test (match-all {1 2 3} (Set Number) [> [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 Number) {[>>>>> ] [_ ]})) (test (match {5 2 1 3 4} (Multiset Number) {[>>>>> ] [_ ]})) (test (match-all {1 2 3 4 5} (Multiset Number) [ [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 Number) [ [x xs]])) (test (match-all {1 2 3} (Stick Number) [ [xs ys]])) (test (match-all {1 2 3 4} (Stick Number) [> [xs w ys]])) (test (match-all {1 2 3} (Stick Number) [,{3 2 1} ])) (match {2 7 7 2 7} (Multiset Number) {[>> (match tmp1 (Multiset Number) {[ (match tmp2 (Multiset Number) {[ (match tmp3 (Multiset Number) {[ ]})]})]})] [_ ]})