Skip to content

Instantly share code, notes, and snippets.

@msszczep
Last active Jun 2, 2018
Embed
What would you like to do?
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