5. Many to One: Reducing
Activity 5.01: Calculating Elo Ratings for Tennis
Solution:
- Here is the minimal
deps.edn
file you'll need:{:deps {org.clojure/data.csv {:mvn/version "0.1.4"} semantic-csv {:mvn/version "0.2.1-alpha1"} org.clojure/math.numeric-tower {:mvn/version "0.0.4"}}}
- Here is the corresponding namespace declaration:
(ns packt-clj.elo (:require [clojure.math.numeric-tower :as math] [clojure.java.io :as io] [clojure.data.csv :as csv] [semantic-csv.core :as sc])
- For the overall structure of your function, we will follow the same patterns we've used so far: a
with-open
macro with some pre-processing code:(defn elo-world ([csv k] (with-open...