Skip to content

Instantly share code, notes, and snippets.

@rockBreaker
Created July 10, 2014 15:32
Show Gist options
  • Save rockBreaker/6f3f439319bbf05b0477 to your computer and use it in GitHub Desktop.
Save rockBreaker/6f3f439319bbf05b0477 to your computer and use it in GitHub Desktop.
funky clojure code, i am bad at naming at formatting
(defn value [hand]
(let [checkers #{[high-card? 0] [pair? 1]
[two-pairs? 2] [three-of-a-kind? 3]
[straight? 4] [flush? 5]
[full-house? 6] [four-of-a-kind? 7]
[straight-flush? 8]}
ita (fn [coll] (if ((first coll) hand) (second coll)))]
(apply max (filter (complement nil?) (map ita checkers)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment