;;; ;;; ;;; Poker-hands demonstration ;;; ;;; ;; ;; Matcher definitions ;; (define $suit (algebraic-data-matcher { })) (define $card (matcher {[ [suit (mod 13)] {[ {[x y]}] [ (match-all [{ } (between 1 13)] [(set suit) (set integer)] [[ ] [s n]])]}] [ [] {[ {[]}]}] [$ [something] {[$tgt {tgt}]}]})) ;; ;; A function that determins poker-hands ;; (define $poker-hands (lambda [$cs] (match cs (multiset card) {[ >>>>> ] [ >>>>> ] [ >>>>> ] [ >>>>> ] [ >>>>> ] [ >>>>> ] [ >>>>> ] [ >>>>> ] [>>>>> ]}))) ;; ;; Demonstration code ;; (test (poker-hands { 12> 10> 1> 11>})) (test (poker-hands { 1> 2> 1> 2>})) (test (poker-hands { 4> 2> 1> 3>})) (test (poker-hands { 4> 10> 1> 3>}))