Skip to content

Instantly share code, notes, and snippets.

@malcolmsparks
Created December 9, 2013 15:29
Show Gist options
  • Save malcolmsparks/7873989 to your computer and use it in GitHub Desktop.
Save malcolmsparks/7873989 to your computer and use it in GitHub Desktop.
bruce
(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