Skip to content

Instantly share code, notes, and snippets.

@statianzo
Created February 27, 2010 02:53
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 statianzo/316430 to your computer and use it in GitHub Desktop.
Save statianzo/316430 to your computer and use it in GitHub Desktop.
(ns com.jstaten.predicates)
(defn non-blank? [line]
(re-find #"\S" line))
(defn non-svn? [file]
(not (.contains (.toString file) ".svn")))
(defn clojure-source? [file]
(.endsWith (.toString file) ".clj"))
(use '[clojure.contrib.io :only (reader)])
(defn clojure-loc [dir]
(reduce +
(for [file (file-seq dir) :when (and (non-svn? file) (clojure-source? file))]
(with-open [reader (reader file)]
(count (filter non-blank? (line-seq reader)))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment