-
-
Save amalloy/e3368747b399e83b91d6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn selections [choices] | |
(if (empty? choices) | |
'(()) | |
(let [more (selections (rest choices))] | |
(for [choice (first choices) | |
answer more] | |
(cons choice answer))))) | |
(defn score-card [[rank suit]] | |
(cond (number? rank) [rank] | |
(= :ace rank) [1 11] | |
:else [10])) | |
(defn score-hand [cards] | |
(map (partial apply +) | |
(selections (map score-card cards)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment