Created
December 9, 2013 15:29
-
-
Save malcolmsparks/7873989 to your computer and use it in GitHub Desktop.
bruce
This file contains hidden or 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
(ns bruce.core) | |
(defn create-hand [] | |
(->> (for [suit [:clubs :diamonds :hearts :spade] | |
rank [:ace :two :three :four :five | |
:six :seven :eight :nine :ten | |
:jack :queen :king]] | |
{:suit suit :rank rank}) | |
shuffle | |
(take 5))) | |
(defn of-a-kind? [num hand] | |
(->> hand | |
(map :rank) | |
frequencies | |
vals | |
(some #(= num %)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment