Skip to content

Instantly share code, notes, and snippets.

@kyleburton
Created November 11, 2010 05:06
Show Gist options
  • Save kyleburton/672037 to your computer and use it in GitHub Desktop.
Save kyleburton/672037 to your computer and use it in GitHub Desktop.
(defn count-area-codes [inp-seq]
(reduce (fn [m line]
(let [phnum (second (.split line "\t"))
[_ area-code] (first (re-seq #"\((\d+)\)" phnum))]
(assoc m area-code (inc (get m area-code 0)))))
{}
inp-seq))
(apply
merge-with +
(map (fn [inp-file]
(count-area-codes (ds/read-lines inp-file)))
(map str (filter #(.isFile %) (.listFiles (java.io.File. "working-dir/"))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment