Skip to content

Instantly share code, notes, and snippets.

@msszczep
Last active June 2, 2018 18:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save msszczep/3d1c1e5fc5f4ccfda6033e04096c3897 to your computer and use it in GitHub Desktop.
Save msszczep/3d1c1e5fc5f4ccfda6033e04096c3897 to your computer and use it in GitHub Desktop.
WQC Score Calculator
; #wqc #clojure
; For the World Quizzing Championships
; http://www.worldquizzingchampionships.com/
(def sample-scores
[["joshua Kreitzer" 1 2 3 4 5 6 7 8]
["Sreeradh RP" 9 10 11 12 13 14 15]
["david striasny" 3 8 8 7 20 4 14 11]])
(defn get-wqc-scores [s]
(letfn [(calculate-score [list-of-scores]
(- (reduce + list-of-scores)
(apply min list-of-scores)))]
(->> s
(map (juxt first (comp calculate-score rest)))
(sort-by second)
reverse)))
; (get-wqc-scores sample-scores)
; => (["Sreeradh RP" 75] ["david striasny" 72] ["joshua Kreitzer" 35])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment