Created
February 5, 2012 04:07
-
-
Save omnisis/1742587 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require '[clojure.data.csv :as csv] | |
'[clojure.java.io :as io]) | |
(defn read-hitting-stats | |
"Reads hitting stats from a CSV file." | |
[csv-file] | |
(with-open [rdr (io/reader csv-file)] | |
(doall | |
(map parse-hitter (csv/read-csv rdr))))) | |
(defn parse-hitter | |
[hitter-row] | |
(zipmap [:name :team :r :hr :rbi :sb :ba :pos] hitter-row)) | |
(defn print-stats [] | |
(map println (read-hitting-stats "stats/hitting.csv"))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment