Skip to content

Instantly share code, notes, and snippets.

@tomjack
Created February 28, 2012 08:35
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 tomjack/c45ee235367c5a160eb2 to your computer and use it in GitHub Desktop.
Save tomjack/c45ee235367c5a160eb2 to your computer and use it in GitHub Desktop.
(let [added-line #"^\+[^\+]"]
(defn get-lines [lines, state]
(when-let [[line & reader] (seq lines)]
(if (is-jsfile-line line) (lazy-seq (get-lines reader "js"))
(if (and (= state "js") (not (is-file-line line)))
(if (and (re-find added-line line) (process-js line))
(cons line
(lazy-seq (get-lines reader "js")))
(lazy-seq (get-lines reader "js")))
(lazy-seq (get-lines reader "not-js")))))))
(doseq [line (get-lines (line-seq (clojure.java.io/reader "/tmp/file")) "not-js")]
(println line))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment