Created
March 28, 2014 23:21
-
-
Save galdolber/9845045 to your computer and use it in GitHub Desktop.
LOC metrics in clojure
This file contains 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
(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