; Bridge hands starter kit ; When dealing with bridge hands, we really want to be talking about ; cards and their ranks and suits. If you asked a friend what the ; butfirst of a card was, they would think you were crazy. So we will ; create an abstraction for cards that allows us to think in terms of ; cards, ranks, and suits, and we will then use those functions. ; Constructor for cards: make-card takes a suit and rank and returns a card (define (make-card suit rank) (word suit rank)) ; Selectors for cards: rank, suit (define (rank card) (bf card)) (define (suit card) (first card)) ; Get the numeric rank of a card (useful for poker project) (define (numeric-rank card) ; allows us to do math on ranks (let ((r (rank card))) (cond ((equal? r 'a) 14) ((equal? r 'k) 13) ((equal? r 'q) 12) ((equal? r 'j) 11) (else r)))) ; Sentences that may or may not be useful, but list all the possibilities (define ranks '(a k q j 10 9 8 7 6 5 4 3 2)) (define numeric-ranks (every numeric-rank ranks)) (define suits '(s h d c))