Skip to content

Instantly share code, notes, and snippets.

@galdolber
Created March 28, 2014 23:21
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 galdolber/9845045 to your computer and use it in GitHub Desktop.
Save galdolber/9845045 to your computer and use it in GitHub Desktop.
LOC metrics in clojure
(use '[clojure.java.io])
(defn walk [dirpath pattern]
(doall (filter #(re-matches pattern (.getName %))
(file-seq (file dirpath)))))
(->> (walk "src" #".*\.clj")
(map #(with-open [rdr (reader (file (.getPath %)))]
(count (line-seq rdr))))
(reduce +))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment