Skip to content

Instantly share code, notes, and snippets.

@omnisis
Created February 5, 2012 04:07
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 omnisis/1742587 to your computer and use it in GitHub Desktop.
Save omnisis/1742587 to your computer and use it in GitHub Desktop.
(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